Use PWD for current download directory on desktop if the defaults do not exist
This commit is contained in:
parent
88fca5e5ef
commit
01e69d2bd4
|
@ -782,10 +782,11 @@ class CwtchFfi implements Cwtch {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String? defaultDownloadPath() {
|
String? defaultDownloadPath() {
|
||||||
|
|
||||||
Map<String, String> envVars = Platform.environment;
|
Map<String, String> envVars = Platform.environment;
|
||||||
String nominalPath = path.join(envVars[Platform.isWindows ? 'UserProfile' : 'HOME']!, "Downloads");
|
String nominalPath = path.join(envVars[Platform.isWindows ? 'UserProfile' : 'HOME']!, "Downloads");
|
||||||
if (Directory(nominalPath).existsSync() == false) {
|
if (Directory(nominalPath).existsSync() == false) {
|
||||||
return null;
|
return Directory.current.path;
|
||||||
}
|
}
|
||||||
return nominalPath;
|
return nominalPath;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue