aboutsummaryrefslogtreecommitdiffstats
path: root/src/config.rs
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2020-05-03 03:30:59 -0400
committerJesse Luehrs <doy@tozt.net>2020-05-03 03:30:59 -0400
commit6ebf7d55e4c553870306a70092cfb677c17429b9 (patch)
tree2d20288e44fa627159d0a4e578f0fb506d16f921 /src/config.rs
parent36b5107239b75136ce74799d87a645e153d95948 (diff)
downloadrbw-6ebf7d55e4c553870306a70092cfb677c17429b9.tar.gz
rbw-6ebf7d55e4c553870306a70092cfb677c17429b9.zip
simplify
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")
- }
}