buildFilePathInDoc static method

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

构建Documents文件路径

弃用方法,推荐用 buildPathInDoc

示例代码:

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

Implementation

@Deprecated('该方法已弃用,请使用PPath.buildPathInDoc方法替代。')
static Future<String> buildFilePathInDoc(String pathFile) async {
  var dir = await PPath.appDocumentDir();
  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;
}