mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-02-02 03:06:35 +00:00
handle previous issue with fetching linux documents directory [skip ci]
This commit is contained in:
parent
f3197a6dbb
commit
6d76130cbe
1 changed files with 11 additions and 3 deletions
|
@ -12,14 +12,22 @@ Future<Directory> getAppDir({String appName = 'cake_wallet'}) async {
|
|||
dir = Directory.fromUri(Uri.file(_rootDirPath!));
|
||||
dir.create(recursive: true);
|
||||
} else {
|
||||
dir = await getApplicationDocumentsDirectory();
|
||||
|
||||
if (Platform.isWindows) {
|
||||
dir = await getApplicationSupportDirectory();
|
||||
} else if (Platform.isLinux) {
|
||||
final appDirPath = '${dir.path}/$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 {
|
||||
dir = await getApplicationDocumentsDirectory();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue