-
Notifications
You must be signed in to change notification settings - Fork 2.2k
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
It's not clear with the error message 'No such file or directory' when no permission to create the file #542
Comments
我的也是这个问题。直接执行完成回调。安卓7.0 |
但是文件夹没有!!! |
@FateChen 可以提供下具体的上下文吗,如果启动了下载,下载结束后会做
希望能够提供尽可能多的信息便于定位问题,根据你们的使用,无法定位到这个问题。 |
目前整个FileDownloader中回调触发完成的只有两个地方:1.
|
这是我的整个代码:
|
然后就直接执行了直接调用blockComplete和completed 、文件夹为空 里面没有文件。我查看过 |
@FateChen 可否交代下遇到该问题的上下文或更详细的用于定位问题的信息。 因为你说 |
上下文指什么? |
@FateChen 对,现在你提供贴的源码就是上下文。 我创建了一个新的分支 论证结果该情况的特征是下载文件存储在需要主动请求存储权限的目录 需要特别注意 manifest中我删除了 情况一AndroidManifest中申明了 这种情况下: 会直接回调 结果 这个并非BUG,并没有直接返回成功。而是返回了 情况二AndroidManifest中申明了 结果 |
特别值得一提的是,如果希望将 /**
* @param path The absolute path for saving the download file.
* @param pathAsDirectory {@code true}: if the {@code path} is absolute directory to store the
* downloading file, and the {@code filename} will be found in
* contentDisposition from the response as default, if can't find
* contentDisposition,the {@code filename} will be generated by
* {@link FileDownloadUtils#generateFileName(String)} with {@code url}.
* </p>
* {@code false}: if the {@code path} = (absolute directory/filename).
* @see #isPathAsDirectory()
* @see #getFilename()
*/
BaseDownloadTask setPath(final String path, final boolean pathAsDirectory); |
也十分感谢这个Issue,这里确实有改进点,在没有权限,并创建父级目录失败后,不应该继续执行接下来的逻辑,直到真正启动下载,开始写入了才发现连父级目录都不存在,此时返回 针对这个 ,在下一个版本我会优化这里的错误信息,将原本的 |
我尝试进行一个简单的下载,没有涉及UI,但是似乎并没有进行下载,Log是直接显示blockComplete和completed,请问我是哪里做错了
private void testDownload() {
String url = "http://apk.tt286.com:8005/api/charge?token=zhuoyou-sz-stkj&from=szstkj&blink=" +
"http://newmarket.tt286.com:8080/180/apk/2017/03/30/1401483xt7/1490864660014.apk&" +
"hot=1&company_type=1&apkid=1088662&imei=865774025208699&userip=192.168.1.178&" +
"network=WIFI&brand=ZTE&model=N958St&resolution=720x1280&dpi=0&osversion=4.4.4&apilevel=19&city=%E6%B7%B1%E5%9C%B3";
FileDownloader.getImpl().create(url)
.setPath(FileDownloadUtils.getDefaultSaveRootPath())
.setListener(new FileDownloadListener() {
@OverRide
protected void pending(BaseDownloadTask task, int soFarBytes, int totalBytes) {
if (DEBUG) Log.d(TAG, "pending: soFarBytes " + soFarBytes);
}
The text was updated successfully, but these errors were encountered: