createDirectoryIfNotExist static method
如果目录不存在,则创建它。
Implementation
static Future<void> createDirectoryIfNotExist(String directoryPath) async {
final directory = Directory(directoryPath);
if (!await directory.exists()) {
print("hello, directory:$directory, !await directory.exists() -> ${!await directory.exists()}");
try {
await directory.create(recursive: true);
} catch (e) {
print("hello: e:$e");
}
print('Directory created: $directoryPath');
}
}