1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-08-01 11:33:29 +02:00

Don't rely on File.canWrite() for directories, closes #406

This commit is contained in:
cpfeiffer 2016-10-10 21:01:41 +02:00
parent f57fec25f8
commit 5c8525c5d0

View File

@ -166,8 +166,8 @@ public class FileUtils {
// the first directory is also the primary external storage, i.e. the same as Environment.getExternalFilesDir() // the first directory is also the primary external storage, i.e. the same as Environment.getExternalFilesDir()
// TODO: check the mount state of *all* dirs when switching to later API level // TODO: check the mount state of *all* dirs when switching to later API level
if (!dir.canWrite() || (i == 0 && !Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState()))) { if (i == 0 && !Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) {
GB.log("ignoring non-writable external storage dir: " + dir, GB.INFO, null); GB.log("ignoring unmounted external storage dir: " + dir, GB.INFO, null);
continue; continue;
} }
result.add(dir); // add last result.add(dir); // add last