makeFile static method
Implementation
static File makeFile(Directory base, {String? file, String? ext, String? dir}) {
String s = file ?? uuidString();
if (notBlank(ext)) {
if (ext!.startsWith(".")) {
s = s + ext;
} else {
s = "$s.$ext";
}
}
if (dir == null || dir.isEmpty) {
return File(joinPath(base.path, s));
}
Directory subdir = Directory(joinPath(base.path, dir));
if (!subdir.existsSync()) {
subdir.createSync(recursive: true);
}
return File(joinPath(subdir.path, s));
}