clearFolder static method

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

清空指定类型的文件夹内容(不删除文件夹本身)

Clears the contents of the specified folder (without deleting the folder itself).

Implementation

static FileResult<void> clearFolder(FolderType type,
    [StorageType? storageType]) {
  final folderPath = getFolderPath(type, storageType);
  if (folderPath == null) {
    return const FileResult.failure('Folder path not found');
  }

  return FileUtil.clearDirectory(folderPath);
}