defaultTemplateDirectoryPath method
Gets default template directory path
Implementation
Future<String> defaultTemplateDirectoryPath() async {
// If running not inside dart vm - exit
if (!Platform.script.hasAbsolutePath) {
throw GenerateTemplatesUnreachableException(
'script entry has no absolute path',
);
}
final defaultDirPath = p.join(p.dirname(Platform.script.path), templatesRelativeToExecutableDirectory);
final dir = Directory(defaultDirPath);
if (!dir.existsSync()) {
dir.createSync(recursive: true);
}
// copy template files from package to executable dir
await copyTemplatesToScriptPath(defaultDirPath);
return defaultDirPath;
}