Use PWD for current download directory on desktop if the defaults do not exist

This commit is contained in:
Sarah Jamie Lewis 2023-01-31 20:45:38 -08:00
parent 88fca5e5ef
commit 01e69d2bd4
1 changed files with 2 additions and 1 deletions

View File

@ -782,10 +782,11 @@ class CwtchFfi implements Cwtch {
@override
String? defaultDownloadPath() {
Map<String, String> envVars = Platform.environment;
String nominalPath = path.join(envVars[Platform.isWindows ? 'UserProfile' : 'HOME']!, "Downloads");
if (Directory(nominalPath).existsSync() == false) {
return null;
return Directory.current.path;
}
return nominalPath;
}