getConfigPath method

Future<(String?, int?)> getConfigPath()

Implementation

Future<(String?, int?)> getConfigPath() async {
  final configPath = await this.settings.path(providedConfigPath);

  if (configPath == null) {
    logger.err('No config file found.');
    return (null, 1);
  }

  logger.detail('Using settings file: $configPath');

  if (fs.currentDirectory.path != fs.file(configPath).parent.path) {
    final newDir = fs.file(configPath).parent;
    logger.detail('Changing directory to ${newDir.path}');
    fs.currentDirectory = newDir;
  }

  return (configPath, null);
}