pathFromRoot static method
Gets a path from within the rootDir
for the specified type
, this will
optionally create
the directory if it doesn't already exist.
Implementation
static String pathFromRoot(KnownPaths type,
[String? rootDir, bool create = true]) {
final safeRoot = rootDir ?? Directory.current.path;
final typePath = relativePathRoots[type];
final typeDir = path.normalize(path.join(safeRoot, typePath));
if (create && !Directory(typeDir).existsSync()) {
Directory(typeDir).createSync(recursive: true);
}
return typeDir;
}