buildFilePathInCache static method

  1. @Deprecated('该方法已弃用,请使用PPath.buildPathInCache方法替代。')
Future<String> buildFilePathInCache(
  1. String pathFile
)

构建Caches文件路径

弃用方法,推荐用 buildPathInCache

示例代码:

String path = await PPath.buildFilePathInCache('dir1/dir2/file.txt'); // 返回完整路径如 Caches/dir1/dir2/file.txt

Implementation

@Deprecated('该方法已弃用,请使用PPath.buildPathInCache方法替代。')
static Future<String> buildFilePathInCache(String pathFile) async {
  final dir = await PPath.appCacheDir();
  final fullPath = dart_path.join(dir.path, pathFile);
  final parentPath = dart_path.dirname(fullPath);
  final parentDir = Directory(parentPath);
  if (!await parentDir.exists()) {
    await parentDir.create(recursive: true);
  }
  return fullPath;
}