configDir static method
The just tool's settings folder: %APPDATA%\just_core_cli on Windows,
~/Library/Application Support/just_core_cli on macOS,
$XDG_CONFIG_HOME/just_core_cli (or ~/.config/just_core_cli) elsewhere —
unless JUST_CORE_CLI_CONFIG_DIR names one. Null when the home folder
can't be found.
Implementation
static String? configDir({Map<String, String>? environment}) {
final env = environment ?? Platform.environment;
final override = _set(env['JUST_CORE_CLI_CONFIG_DIR']);
if (override != null) return _trimmed(override);
String? base;
if (Platform.isWindows) {
base = _set(env['APPDATA']) ?? _set(env['LOCALAPPDATA']);
} else if (Platform.isMacOS) {
final home = _set(env['HOME']);
base = home == null ? null : '$home/Library/Application Support';
} else {
final home = _set(env['HOME']);
base =
_absolute(env['XDG_CONFIG_HOME']) ??
(home == null ? null : '$home/.config');
}
return base == null ? null : '${_trimmed(base)}/just_core_cli';
}