deleteFolder static method

FileResult<void> deleteFolder(
  1. FolderType type, [
  2. StorageType? storageType
])

删除指定类型的文件夹及其所有内容

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) {
    _folderCache.remove(type);
  }

  return result;
}