createFile function

void createFile(
  1. String path
)

创建文件

Implementation

void createFile(String path) {
  File file = File(path);
  if (!file.existsSync()) {
    Directory parent = file.parent;
    if (!parent.existsSync()) {
      createDir(parent.absolute.path);
    }
    file.createSync();
    "${file.path} 文件创建完成".logI();
  } else {
    "${file.path} 文件已存在".logI();
  }
}