mirror of
https://github.com/emanuele-f/PCAPdroid.git
synced 2026-07-03 21:21:12 +08:00
Fix "no such file or directory" with dump to file
On older devices it's necessary to manually create the downloads subfolder Fixes #289
This commit is contained in:
parent
905704d1a1
commit
92b89fa5be
@ -757,7 +757,15 @@ public class Utils {
|
||||
}
|
||||
|
||||
// NOTE: context.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS) returns an app internal folder
|
||||
String path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS) + "/PCAPdroid/" + fname;
|
||||
File downloadsDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
|
||||
File folder = new File(downloadsDir + "/PCAPdroid");
|
||||
try {
|
||||
folder.mkdirs();
|
||||
} catch (Exception ignored) {}
|
||||
if(!folder.exists())
|
||||
folder = downloadsDir;
|
||||
|
||||
String path = folder + "/" + fname;
|
||||
Log.d(TAG, "getDownloadsUri: path=" + path);
|
||||
selectQuery = MediaStore.MediaColumns.DATA + "='" + path + "'";
|
||||
values.put(MediaStore.MediaColumns.DATA, path);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user