mirror of
https://github.com/veeso/termscp.git
synced 2025-12-07 09:36:00 -08:00
Fixed system test which deleted the termscp configuration
This commit is contained in:
@@ -31,6 +31,7 @@ Released on 27/03/2021
|
|||||||
- Fixed a bug causing termscp to crash if removing a bookmark
|
- Fixed a bug causing termscp to crash if removing a bookmark
|
||||||
- Fixed file format cursor position in the GUI
|
- Fixed file format cursor position in the GUI
|
||||||
- Fixed a bug causing termscp to show two equal bookmarks when overwriting one.
|
- 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
|
- **LICENSE**: changed license to MIT
|
||||||
- Dependencies:
|
- Dependencies:
|
||||||
- Removed `unicode-width`
|
- Removed `unicode-width`
|
||||||
|
|||||||
@@ -37,9 +37,14 @@ use std::path::{Path, PathBuf};
|
|||||||
/// Returns None, if it's not possible to get it
|
/// Returns None, if it's not possible to get it
|
||||||
pub fn init_config_dir() -> Result<Option<PathBuf>, String> {
|
pub fn init_config_dir() -> Result<Option<PathBuf>, String> {
|
||||||
// Get file
|
// Get file
|
||||||
|
#[cfg(not(test))]
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
static ref CONF_DIR: Option<PathBuf> = dirs::config_dir();
|
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() {
|
if CONF_DIR.is_some() {
|
||||||
// Get path of bookmarks
|
// Get path of bookmarks
|
||||||
let mut p: PathBuf = CONF_DIR.as_ref().unwrap().clone();
|
let mut p: PathBuf = CONF_DIR.as_ref().unwrap().clone();
|
||||||
@@ -100,7 +105,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_system_environment_get_config_dir_err() {
|
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");
|
conf_dir.push("termscp");
|
||||||
// Create file
|
// Create file
|
||||||
let mut f: File = OpenOptions::new()
|
let mut f: File = OpenOptions::new()
|
||||||
|
|||||||
Reference in New Issue
Block a user