Skip to content

Commit

Permalink
issue 150: fixed config directory not being created
Browse files Browse the repository at this point in the history
  • Loading branch information
veeso committed Feb 27, 2023
1 parent 7ecfaea commit 9e22b63
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changelog

- [Changelog](#changelog)
- [0.11.1](#0111)
- [0.11.0](#0110)
- [0.10.0](#0100)
- [0.9.0](#090)
Expand All @@ -27,6 +28,12 @@

---

## 0.11.1

Released on ??

- [Issue 150](https://github.com/veeso/termscp/issues/150): fixed config directory not being created

## 0.11.0

Released on 20/02/2023
Expand Down
13 changes: 7 additions & 6 deletions src/system/environment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@ pub fn init_config_dir() -> Result<Option<PathBuf>, String> {
// Append termscp dir
p.push("termscp/");
// If directory doesn't exist, create it
match p.exists() {
true => Ok(Some(p)),
false => match std::fs::create_dir(p.as_path()) {
Ok(_) => Ok(Some(p)),
Err(err) => Err(err.to_string()),
},
if p.exists() {
return Ok(Some(p));
}
// directory doesn't exist; create dir recursively
match std::fs::create_dir_all(p.as_path()) {
Ok(_) => Ok(Some(p)),
Err(err) => Err(err.to_string()),
}
} else {
Ok(None)
Expand Down

0 comments on commit 9e22b63

Please sign in to comment.