mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-26 05:29:57 +00:00
5827a8977c
* chore: build changes * refactor: better solution to `nice()` problem * fix: errors trying to open documents file * fix: haven wallet class * chore: use forked device_display_brightness
26 lines
715 B
Dart
26 lines
715 B
Dart
import 'dart:io';
|
|
import 'package:path_provider/path_provider.dart';
|
|
|
|
String? _rootDirPath;
|
|
|
|
void setRootDirFromEnv() => _rootDirPath = Platform.environment['CAKE_WALLET_DIR'];
|
|
|
|
Future<Directory> getAppDir({String appName = 'cake_wallet'}) async {
|
|
Directory dir;
|
|
|
|
if (_rootDirPath != null && _rootDirPath!.isNotEmpty) {
|
|
dir = Directory.fromUri(Uri.file(_rootDirPath!));
|
|
dir.create(recursive: true);
|
|
} else {
|
|
if (Platform.isLinux) {
|
|
final appDirPath = '/home/${Platform.environment['USER']}/.$appName';
|
|
dir = Directory.fromUri(Uri.file(appDirPath));
|
|
await dir.create(recursive: true);
|
|
} else {
|
|
dir = await getApplicationDocumentsDirectory();
|
|
}
|
|
}
|
|
|
|
return dir;
|
|
}
|
|
|