getBasePath static method

String? getBasePath([
  1. StorageType? type
])

Get base path by storage type (已包含子目录)

根据存储类型获取基础路径

type 存储类型,如果为null则使用默认类型

Implementation

static String? getBasePath([StorageType? type]) {
  if (_storageConfig == null) {
    loge('getBasePath: _storageConfig is null');
    return null;
  }

  final targetType = type ?? _defaultStorageType;
  final path = _storageConfig!.getPath(targetType);

  if (path != null) {
    logi('getBasePath: type=$targetType, path=$path');
    return path;
  }

  // 回退到默认路径
  final fallback = _storageConfig!.defaultPath;
  logw('getBasePath: no path for $targetType, falling back to: $fallback');
  return fallback;
}