Fixed system test which deleted the termscp configuration

This commit is contained in:
veeso
2021-03-27 11:56:18 +01:00
parent 3dbe024029
commit 67e36fa38f
2 changed files with 7 additions and 1 deletions

View File

@@ -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`

View File

@@ -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<Option<PathBuf>, String> {
// Get file
#[cfg(not(test))]
lazy_static! {
static ref CONF_DIR: Option<PathBuf> = dirs::config_dir();
}
#[cfg(test)]
lazy_static! {
static ref CONF_DIR: Option<PathBuf> = 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()