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