fix: only use new directory in the failure case

since other builds could have worked and have already wallet files in the documents folder
This commit is contained in:
Rafael Saes 2023-09-26 15:50:08 -03:00
parent 678e402633
commit f16a86cdfe

View file

@ -13,7 +13,15 @@ Future<Directory> getAppDir({String appName = 'cake_wallet'}) async {
dir.create(recursive: true);
} else {
if (Platform.isLinux) {
final appDirPath = '/home/${Platform.environment['USER']}/.$appName';
String appDirPath;
try {
dir = await getApplicationDocumentsDirectory();
appDirPath = '${dir.path}/$appName';
} catch (e) {
appDirPath = '/home/${Platform.environment['USER']}/.$appName';
}
dir = Directory.fromUri(Uri.file(appDirPath));
await dir.create(recursive: true);
} else {
@ -23,4 +31,3 @@ Future<Directory> getAppDir({String appName = 'cake_wallet'}) async {
return dir;
}