initializeAllFolders static method

FileResult<Map<FolderType, String>> initializeAllFolders([
  1. StorageType? storageType
])

初始化所有预定义类型的文件夹

Initializes all predefined folder types.

Implementation

static FileResult<Map<FolderType, String>> initializeAllFolders(
    [StorageType? storageType]) {
  final Map<FolderType, String> results = {};
  final List<String> errors = [];

  for (final type in FolderType.values) {
    final folderPath = getFolderPath(type, storageType);
    if (folderPath != null) {
      results[type] = folderPath;
    } else {
      errors.add('Failed to initialize ${type.folderName}');
    }
  }

  if (errors.isNotEmpty) {
    return FileResult.failure(errors.join(', '));
  }

  return FileResult.success(results);
}