diff --git a/CHANGELOG.md b/CHANGELOG.md index 043b7da..981e44c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ Released on 27/03/2021 - Fixed a bug causing termscp to crash if removing a bookmark - Fixed file format cursor position in the GUI - Fixed a bug causing termscp to show two equal bookmarks when overwriting one. + - Fixed system tests which deleted the termscp configuration when launched - **LICENSE**: changed license to MIT - Dependencies: - Removed `unicode-width` diff --git a/src/system/environment.rs b/src/system/environment.rs index b4022b9..44d2b59 100644 --- a/src/system/environment.rs +++ b/src/system/environment.rs @@ -37,9 +37,14 @@ use std::path::{Path, PathBuf}; /// Returns None, if it's not possible to get it pub fn init_config_dir() -> Result, String> { // Get file + #[cfg(not(test))] lazy_static! { static ref CONF_DIR: Option = dirs::config_dir(); } + #[cfg(test)] + lazy_static! { + static ref CONF_DIR: Option = Some(std::env::temp_dir()); + } if CONF_DIR.is_some() { // Get path of bookmarks let mut p: PathBuf = CONF_DIR.as_ref().unwrap().clone(); @@ -100,7 +105,7 @@ mod tests { #[test] fn test_system_environment_get_config_dir_err() { - let mut conf_dir: PathBuf = dirs::config_dir().unwrap(); + let mut conf_dir: PathBuf = std::env::temp_dir(); conf_dir.push("termscp"); // Create file let mut f: File = OpenOptions::new()