[−][src]Function tweetr::ops::init::verify
pub fn verify(
config_dir: &(String, PathBuf),
force: bool
) -> Result<PathBuf, Outcome>
Verify if, given the current configuration, it's permitted to continue with the subsequent steps of the init
subsystem.
The return value contains either the path to the file containing the global app configuration or why getting it failed.
Examples
Verifying a nonexistant file or an existing file with forcing.
let tf = temp_dir().join("tweetr-doctest").join("ops-init-verify-0"); assert_eq!(init::verify(&("$TEMP/ops-init-verify-0".to_string(), tf.clone()), true), Ok(tf.join("app.toml")));
Verifying an existing file without forcing.
let tf = temp_dir().join("tweetr-doctest").join("ops-init-verify-1"); fs::create_dir_all(&tf).unwrap(); File::create(tf.join("app.toml")).unwrap().write(&[]).unwrap(); assert_eq!(init::verify(&("$TEMP/ops-init-verify-1".to_string(), tf), false), Err(Outcome::OverrideNoForce("$TEMP/ops-init-verify-1/app.toml".to_string())));