ensureFolder static method
确保指定类型的文件夹存在,若不存在则尝试创建
Ensures the folder of the specified type exists; creates it if it doesn't.
Implementation
static FileResult<String> ensureFolder(FolderType type,
[StorageType? storageType]) {
final folderPath = getFolderPath(type, storageType);
if (folderPath == null) {
return const FileResult.failure('Failed to get or create folder path');
}
return FileResult.success(folderPath);
}