aboutsummaryrefslogtreecommitdiffstats
path: root/src/config.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/config.rs')
-rw-r--r--src/config.rs10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/config.rs b/src/config.rs
index 55f6806..5b3cfd3 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -22,7 +22,7 @@ impl Config {
}
pub fn load() -> Result<Self> {
- let mut fh = std::fs::File::open(Self::filename())
+ let mut fh = std::fs::File::open(crate::dirs::config_file())
.context(crate::error::LoadConfig)?;
let mut json = String::new();
fh.read_to_string(&mut json)
@@ -33,7 +33,7 @@ impl Config {
}
pub async fn load_async() -> Result<Self> {
- let mut fh = tokio::fs::File::open(Self::filename())
+ let mut fh = tokio::fs::File::open(crate::dirs::config_file())
.await
.context(crate::error::LoadConfigAsync)?;
let mut json = String::new();
@@ -46,7 +46,7 @@ impl Config {
}
pub fn save(&self) -> Result<()> {
- let filename = Self::filename();
+ let filename = crate::dirs::config_file();
// unwrap is safe here because Self::filename is explicitly
// constructed as a filename in a directory
std::fs::create_dir_all(filename.parent().unwrap())
@@ -77,8 +77,4 @@ impl Config {
)
})
}
-
- fn filename() -> std::path::PathBuf {
- crate::dirs::config_dir().join("config.json")
- }
}