deleteFolder static method
删除指定类型的文件夹及其所有内容
Deletes the specified folder and all its contents.
Implementation
static FileResult<void> deleteFolder(
FolderType type, [
StorageType? storageType,
]) {
final folderPath = getFolderPath(type, storageType);
if (folderPath == null) {
return const FileResult.failure('Folder path not found');
}
final result = FileUtil.deleteDirectory(folderPath, recursive: true);
if (result.success) {
final targetStorageType =
storageType ?? StorageManager.defaultStorageType;
_folderCache.remove((type, targetStorageType));
}
return result;
}