getDistDirectory static method
dist 各项目的存放目录
Implementation
static Future<Directory> getDistDirectory() async {
Directory directory;
if (distDirectory != null) {
return distDirectory!;
}
if (cacheDirectory != null) {
directory = Directory(cacheDirectory!);
} else {
directory = await getTemporaryDirectory();
cacheDirectory = '${directory.path}/$kFileName';
}
String distPath = '${directory.path}/$kFileNameDist';
final tmpDirectory = Directory(distPath);
if (tmpDirectory.existsSync()) {
distDirectory = tmpDirectory;
return tmpDirectory;
} else {
try {
final tmpDir = await tmpDirectory.create(recursive: true);
distDirectory = tmpDir;
return tmpDir;
} catch (e) {
rethrow;
}
}
}