This repository has been archived by the owner on Oct 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add cfg_dir function to get/create .wash directory Signed-off-by: Matt Wilkinson <mattwilki17@gmail.com> * update all references to .wash & add .vscode automatic signoff setting Signed-off-by: Matt Wilkinson <mattwilki17@gmail.com> * add .vscode to gitignore Signed-off-by: Matt Wilkinson <mattwilki17@gmail.com> * add .vscode to gitignore Signed-off-by: Matt Wilkinson <mattwilki17@gmail.com>
- Loading branch information
Matt Wilkinson
authored
Dec 13, 2021
1 parent
70d4489
commit 7d0e031
Showing
5 changed files
with
47 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,3 +16,4 @@ | |
*.par.gz | ||
*.gz | ||
flake.lock | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
use crate::util::Result; | ||
use std::{ | ||
fs, | ||
io::{Error, ErrorKind}, | ||
path::PathBuf, | ||
}; | ||
|
||
const WASH_DIR: &str = ".wash"; | ||
|
||
/// Get the path to the `.wash` configuration directory. | ||
/// Creates the directory if it does not exist. | ||
pub fn cfg_dir() -> Result<PathBuf> { | ||
let home = dirs::home_dir().ok_or_else(|| { | ||
Error::new( | ||
ErrorKind::NotFound, | ||
"No home directory found. Please set $HOME.", | ||
) | ||
})?; | ||
|
||
let wash = home.join(WASH_DIR); | ||
|
||
if !wash.exists() { | ||
fs::create_dir_all(&wash)?; | ||
} | ||
|
||
Ok(wash) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters