check if writable

This commit is contained in:
tobiasKaminsky 2017-05-04 14:24:48 +02:00
parent 8ccff56370
commit 2c2959a08d
No known key found for this signature in database
GPG key ID: 0E00D4D47D0C5AF7

View file

@ -43,8 +43,7 @@ public class SystemDefaultStoragePointProvider extends AbstractStoragePointProvi
public Vector<StoragePoint> getAvailableStoragePoint() { public Vector<StoragePoint> getAvailableStoragePoint() {
Vector<StoragePoint> result = new Vector<>(); Vector<StoragePoint> result = new Vector<>();
final String defaultStringDesc = final String defaultStringDesc = MainApp.getAppContext().getString(R.string.storage_description_default);
MainApp.getAppContext().getString(R.string.storage_description_default);
File path; File path;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) { if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
path = MainApp.getAppContext().getExternalMediaDirs()[0]; path = MainApp.getAppContext().getExternalMediaDirs()[0];
@ -52,7 +51,7 @@ public class SystemDefaultStoragePointProvider extends AbstractStoragePointProvi
path = getExternalStorageDirectory(); path = getExternalStorageDirectory();
} }
if (path != null) { if (path != null && path.canWrite()) {
result.add(new StoragePoint(defaultStringDesc, path.getAbsolutePath())); result.add(new StoragePoint(defaultStringDesc, path.getAbsolutePath()));
} }