Rename .gitignore APP_FOO to ARTI_FOO.
Since these shell-variables are hardwired to use org.torproject.Arti as the program name, it isn't appropriate to call them "app-specific". If we someday reinstate APP_FOO, it should be based on a user-provided application name.
This commit is contained in:
parent
05be12e4d8
commit
efdd327569
|
@ -171,7 +171,7 @@ impl TorClientConfig {
|
||||||
/// Returns a `TorClientConfig` using reasonably sane defaults.
|
/// Returns a `TorClientConfig` using reasonably sane defaults.
|
||||||
///
|
///
|
||||||
/// This gies the same result as using `tor_config`'s definitions
|
/// This gies the same result as using `tor_config`'s definitions
|
||||||
/// for `APP_LOCAL_DATA` and `APP_CACHE` for the state and cache
|
/// for `ARTI_LOCAL_DATA` and `ARTI_CACHE` for the state and cache
|
||||||
/// directories respectively.
|
/// directories respectively.
|
||||||
///
|
///
|
||||||
/// (On unix, this usually works out to `~/.local/share/arti` and
|
/// (On unix, this usually works out to `~/.local/share/arti` and
|
||||||
|
|
|
@ -32,16 +32,16 @@ trace_filter = "debug"
|
||||||
# These paths can use ~ to indicate the user's home directory, or a set
|
# These paths can use ~ to indicate the user's home directory, or a set
|
||||||
# of shell-style variables to indicate platform-specific paths.
|
# of shell-style variables to indicate platform-specific paths.
|
||||||
#
|
#
|
||||||
# Supported variables are APP_CACHE, APP_CONFIG, APP_SHARED_DATA,
|
# Supported variables are ARTI_CACHE, ARTI_CONFIG, ARTI_SHARED_DATA,
|
||||||
# APP_LOCAL_DATA, and USER_HOME.
|
# ARTI_LOCAL_DATA, and USER_HOME.
|
||||||
#
|
#
|
||||||
# Multiple processes can share the same cache_dir. If they do, one of them
|
# Multiple processes can share the same cache_dir. If they do, one of them
|
||||||
# will download directory information for all of the others.
|
# will download directory information for all of the others.
|
||||||
#
|
#
|
||||||
# The state directory is not yet used.
|
# The state directory is not yet used.
|
||||||
[storage]
|
[storage]
|
||||||
cache_dir = "${APP_CACHE}"
|
cache_dir = "${ARTI_CACHE}"
|
||||||
state_dir = "${APP_LOCAL_DATA}"
|
state_dir = "${ARTI_LOCAL_DATA}"
|
||||||
|
|
||||||
# Replacement values for consensus parameters. This is an advanced option
|
# Replacement values for consensus parameters. This is an advanced option
|
||||||
# and you probably should leave it alone. Not all parameters are supported.
|
# and you probably should leave it alone. Not all parameters are supported.
|
||||||
|
|
|
@ -91,7 +91,7 @@ fn load_mut<P: AsRef<Path>>(
|
||||||
|
|
||||||
/// Return a filename for the default user configuration file.
|
/// Return a filename for the default user configuration file.
|
||||||
pub fn default_config_file() -> Option<PathBuf> {
|
pub fn default_config_file() -> Option<PathBuf> {
|
||||||
CfgPath::new("${APP_CONFIG}/arti.toml".into()).path().ok()
|
CfgPath::new("${ARTI_CONFIG}/arti.toml".into()).path().ok()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|
|
@ -13,11 +13,11 @@ use serde::Deserialize;
|
||||||
/// with expansion of certain variables.
|
/// with expansion of certain variables.
|
||||||
///
|
///
|
||||||
/// The supported variables are:
|
/// The supported variables are:
|
||||||
/// * `APP_CACHE`: an arti-specific cache directory.
|
/// * `ARTI_CACHE`: an arti-specific cache directory.
|
||||||
/// * `APP_CONFIG`: an arti-specific configuration directory.
|
/// * `ARTI_CONFIG`: an arti-specific configuration directory.
|
||||||
/// * `APP_SHARED_DATA`: an arti-specific directory in the user's "shared
|
/// * `ARTI_SHARED_DATA`: an arti-specific directory in the user's "shared
|
||||||
/// data" space.
|
/// data" space.
|
||||||
/// * `APP_LOCAL_DATA`: an arti-specific directory in the user's "local
|
/// * `ARTI_LOCAL_DATA`: an arti-specific directory in the user's "local
|
||||||
/// data" space.
|
/// data" space.
|
||||||
/// * `USER_HOME`: the user's home directory.
|
/// * `USER_HOME`: the user's home directory.
|
||||||
///
|
///
|
||||||
|
@ -108,10 +108,10 @@ fn get_home() -> Option<&'static Path> {
|
||||||
#[cfg(feature = "expand-paths")]
|
#[cfg(feature = "expand-paths")]
|
||||||
fn get_env(var: &str) -> Result<Option<&'static str>, CfgPathError> {
|
fn get_env(var: &str) -> Result<Option<&'static str>, CfgPathError> {
|
||||||
let path = match var {
|
let path = match var {
|
||||||
"APP_CACHE" => project_dirs()?.cache_dir(),
|
"ARTI_CACHE" => project_dirs()?.cache_dir(),
|
||||||
"APP_CONFIG" => project_dirs()?.config_dir(),
|
"ARTI_CONFIG" => project_dirs()?.config_dir(),
|
||||||
"APP_SHARED_DATA" => project_dirs()?.data_dir(),
|
"ARTI_SHARED_DATA" => project_dirs()?.data_dir(),
|
||||||
"APP_LOCAL_DATA" => project_dirs()?.data_local_dir(),
|
"ARTI_LOCAL_DATA" => project_dirs()?.data_local_dir(),
|
||||||
"USER_HOME" => base_dirs()?.home_dir(),
|
"USER_HOME" => base_dirs()?.home_dir(),
|
||||||
_ => return Err(CfgPathError::UnknownVar(var.to_owned())),
|
_ => return Err(CfgPathError::UnknownVar(var.to_owned())),
|
||||||
};
|
};
|
||||||
|
@ -188,8 +188,8 @@ mod test {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn expand_cache() {
|
fn expand_cache() {
|
||||||
let p = CfgPath::new("${APP_CACHE}/example".to_string());
|
let p = CfgPath::new("${ARTI_CACHE}/example".to_string());
|
||||||
assert_eq!(p.to_string(), "${APP_CACHE}/example".to_string());
|
assert_eq!(p.to_string(), "${ARTI_CACHE}/example".to_string());
|
||||||
|
|
||||||
let expected = project_dirs().unwrap().cache_dir().join("example");
|
let expected = project_dirs().unwrap().cache_dir().join("example");
|
||||||
assert_eq!(p.path().unwrap().to_str(), expected.to_str());
|
assert_eq!(p.path().unwrap().to_str(), expected.to_str());
|
||||||
|
@ -197,8 +197,8 @@ mod test {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn expand_bogus() {
|
fn expand_bogus() {
|
||||||
let p = CfgPath::new("${APP_WOMBAT}/example".to_string());
|
let p = CfgPath::new("${ARTI_WOMBAT}/example".to_string());
|
||||||
assert_eq!(p.to_string(), "${APP_WOMBAT}/example".to_string());
|
assert_eq!(p.to_string(), "${ARTI_WOMBAT}/example".to_string());
|
||||||
|
|
||||||
assert!(p.path().is_err());
|
assert!(p.path().is_err());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue