getProjectRootPath function

String? getProjectRootPath({
  1. String? scriptPath,
})

Implementation

String? getProjectRootPath({String? scriptPath}) {
  String scriptDir = "";
  String currentWorkingDirectory = Directory.current.path;

  if (scriptPath == null) {
    //current directory
    scriptDir = currentWorkingDirectory;
  } else {
    final scriptPath0 = scriptPath;
    scriptDir = p.dirname(scriptPath0);
  }
  final root = _findProjectRoot(Directory(scriptDir));
  return root?.path;
}