mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-28 06:28:41 +01:00
Upstream reformatted its whole tree in 16ddc0837. Matching it removes
formatting from the conflict surface of this and every later sync.
38 lines
1.1 KiB
Dart
38 lines
1.1 KiB
Dart
import 'dart:io';
|
|
import 'package:cw_core/root_dir.dart';
|
|
import 'package:cw_core/wallet_type.dart';
|
|
|
|
Future<String> pathForWalletTypeDir({required WalletType type}) async {
|
|
final root = await getAppDir();
|
|
final prefix = walletTypeToString(type).toLowerCase();
|
|
final walletsDir = Directory('${root.path}/wallets');
|
|
final walletDir = Directory('${walletsDir.path}/$prefix');
|
|
|
|
if (!walletDir.existsSync()) {
|
|
walletDir.createSync(recursive: true);
|
|
}
|
|
|
|
return walletDir.path;
|
|
}
|
|
|
|
Future<String> pathForWalletDir({required String name, required WalletType type}) async {
|
|
final typeRoot = await pathForWalletTypeDir(type: type);
|
|
final walletDire = Directory('${typeRoot}/$name');
|
|
|
|
if (!walletDire.existsSync()) {
|
|
walletDire.createSync(recursive: true);
|
|
}
|
|
|
|
return walletDire.path;
|
|
}
|
|
|
|
Future<String> pathForWallet({required String name, required WalletType type}) async =>
|
|
await pathForWalletDir(name: name, type: type).then((path) => path + '/$name');
|
|
|
|
Future<String> outdatedAndroidPathForWalletDir({required String name}) async {
|
|
final directory = await getAppDir();
|
|
final pathDir = directory.path + '/$name';
|
|
|
|
return pathDir;
|
|
}
|