getGlobalNeomageFile function

String getGlobalNeomageFile({
  1. String fileSuffix = '',
})

Returns the path to the global neomage config JSON file.

Implementation

String getGlobalNeomageFile({String fileSuffix = ''}) {
  if (_globalNeomageFileCache != null) return _globalNeomageFileCache!;

  // Legacy fallback
  final legacyPath = p.join(getNeomageConfigHomeDir(), '.config.json');
  if (File(legacyPath).existsSync()) {
    _globalNeomageFileCache = legacyPath;
    return legacyPath;
  }

  final filename = '.neomage$fileSuffix.json';
  _globalNeomageFileCache = p.join(
    Platform.environment['MAGE_CONFIG_DIR'] ?? _homedir(),
    filename,
  );
  return _globalNeomageFileCache!;
}