mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-09-12 22:24:40 +08:00
External Dir: Add more logs
+ explicitly ask for permission. Not that this seems to help, for me.
This commit is contained in:
@ -516,10 +516,16 @@ Future<bool> _isDirWritable(String path) async {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<String> _getExternalDir() async {
|
Future<String> _getExternalDir() async {
|
||||||
|
if (!await Permission.storage.request().isGranted) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
var dir = await FilePicker.platform.getDirectoryPath();
|
var dir = await FilePicker.platform.getDirectoryPath();
|
||||||
if (dir != null && dir.isNotEmpty) {
|
if (dir != null && dir.isNotEmpty) {
|
||||||
if (await _isDirWritable(dir)) {
|
if (await _isDirWritable(dir)) {
|
||||||
return dir;
|
return dir;
|
||||||
|
} else {
|
||||||
|
Log.e("FilePicker: Got $dir but it is not writable");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -531,6 +537,8 @@ Future<String> _getExternalDir() async {
|
|||||||
var path = await ExtStorage.getExternalStorageDirectory();
|
var path = await ExtStorage.getExternalStorageDirectory();
|
||||||
if (await _isDirWritable(path)) {
|
if (await _isDirWritable(path)) {
|
||||||
return path;
|
return path;
|
||||||
|
} else {
|
||||||
|
Log.e("ExtStorage: Got $path but it is not writable");
|
||||||
}
|
}
|
||||||
|
|
||||||
var extDir = await getExternalStorageDirectory();
|
var extDir = await getExternalStorageDirectory();
|
||||||
@ -538,6 +546,8 @@ Future<String> _getExternalDir() async {
|
|||||||
|
|
||||||
if (await _isDirWritable(path)) {
|
if (await _isDirWritable(path)) {
|
||||||
return path;
|
return path;
|
||||||
|
} else {
|
||||||
|
Log.e("ExternalStorageDirectory: Got $path but it is not writable");
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
|
Reference in New Issue
Block a user