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:
Nick Mathewson 2021-11-21 11:27:43 -05:00
parent 05be12e4d8
commit efdd327569
4 changed files with 18 additions and 18 deletions

View File

@ -171,7 +171,7 @@ impl TorClientConfig {
/// Returns a `TorClientConfig` using reasonably sane defaults.
///
/// 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.
///
/// (On unix, this usually works out to `~/.local/share/arti` and

View File

@ -32,16 +32,16 @@ trace_filter = "debug"
# These paths can use ~ to indicate the user's home directory, or a set
# of shell-style variables to indicate platform-specific paths.
#
# Supported variables are APP_CACHE, APP_CONFIG, APP_SHARED_DATA,
# APP_LOCAL_DATA, and USER_HOME.
# Supported variables are ARTI_CACHE, ARTI_CONFIG, ARTI_SHARED_DATA,
# ARTI_LOCAL_DATA, and USER_HOME.
#
# Multiple processes can share the same cache_dir. If they do, one of them
# will download directory information for all of the others.
#
# The state directory is not yet used.
[storage]
cache_dir = "${APP_CACHE}"
state_dir = "${APP_LOCAL_DATA}"
cache_dir = "${ARTI_CACHE}"
state_dir = "${ARTI_LOCAL_DATA}"
# Replacement values for consensus parameters. This is an advanced option
# and you probably should leave it alone. Not all parameters are supported.

View File

@ -91,7 +91,7 @@ fn load_mut<P: AsRef<Path>>(
/// Return a filename for the default user configuration file.
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)]

View File

@ -13,11 +13,11 @@ use serde::Deserialize;
/// with expansion of certain variables.
///
/// The supported variables are:
/// * `APP_CACHE`: an arti-specific cache directory.
/// * `APP_CONFIG`: an arti-specific configuration directory.
/// * `APP_SHARED_DATA`: an arti-specific directory in the user's "shared
/// * `ARTI_CACHE`: an arti-specific cache directory.
/// * `ARTI_CONFIG`: an arti-specific configuration directory.
/// * `ARTI_SHARED_DATA`: an arti-specific directory in the user's "shared
/// 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.
/// * `USER_HOME`: the user's home directory.
///
@ -108,10 +108,10 @@ fn get_home() -> Option<&'static Path> {
#[cfg(feature = "expand-paths")]
fn get_env(var: &str) -> Result<Option<&'static str>, CfgPathError> {
let path = match var {
"APP_CACHE" => project_dirs()?.cache_dir(),
"APP_CONFIG" => project_dirs()?.config_dir(),
"APP_SHARED_DATA" => project_dirs()?.data_dir(),
"APP_LOCAL_DATA" => project_dirs()?.data_local_dir(),
"ARTI_CACHE" => project_dirs()?.cache_dir(),
"ARTI_CONFIG" => project_dirs()?.config_dir(),
"ARTI_SHARED_DATA" => project_dirs()?.data_dir(),
"ARTI_LOCAL_DATA" => project_dirs()?.data_local_dir(),
"USER_HOME" => base_dirs()?.home_dir(),
_ => return Err(CfgPathError::UnknownVar(var.to_owned())),
};
@ -188,8 +188,8 @@ mod test {
#[test]
fn expand_cache() {
let p = CfgPath::new("${APP_CACHE}/example".to_string());
assert_eq!(p.to_string(), "${APP_CACHE}/example".to_string());
let p = CfgPath::new("${ARTI_CACHE}/example".to_string());
assert_eq!(p.to_string(), "${ARTI_CACHE}/example".to_string());
let expected = project_dirs().unwrap().cache_dir().join("example");
assert_eq!(p.path().unwrap().to_str(), expected.to_str());
@ -197,8 +197,8 @@ mod test {
#[test]
fn expand_bogus() {
let p = CfgPath::new("${APP_WOMBAT}/example".to_string());
assert_eq!(p.to_string(), "${APP_WOMBAT}/example".to_string());
let p = CfgPath::new("${ARTI_WOMBAT}/example".to_string());
assert_eq!(p.to_string(), "${ARTI_WOMBAT}/example".to_string());
assert!(p.path().is_err());
}