/// Represents keys in the environment that can be used to locate a user's /// configuration file. @_spi(Internal) public enum EnvironmentKey { static let xdgConfigHome = "XDG_CONFIG_HOME" static let hpaConfigHome = "HPA_CONFIG_HOME" static let hpaConfigFile = "HPA_CONFIG_FILE" } /// Represents keys that are used internally for directory names, file names, etc. @_spi(Internal) public enum HPAKey { public static let configDirName = "hpa" public static let resourceFileName = "hpa" public static let resourceFileExtension = "toml" public static let defaultFileName = "config.toml" public static let defaultFileNameWithoutExtension = "config.toml" } extension [String: String] { var xdgConfigHome: String { self[EnvironmentKey.xdgConfigHome] ?? "~/.config" } var hpaConfigHome: String? { self[EnvironmentKey.hpaConfigHome] } var hpaConfigFile: String? { self[EnvironmentKey.hpaConfigFile] } }