diff options
author | FxQnLr <[email protected]> | 2023-04-27 10:08:20 +0200 |
---|---|---|
committer | FxQnLr <[email protected]> | 2023-04-27 10:08:20 +0200 |
commit | 4e6466af1329f7b9e341df2e76ab696d11f80c93 (patch) | |
tree | eef58fecfadad90386b38af581abab8cc3d3cfc0 /src/config.rs | |
parent | f1912007484f077b5585a872ca732d087beefa9a (diff) | |
download | modlist-4e6466af1329f7b9e341df2e76ab696d11f80c93.tar modlist-4e6466af1329f7b9e341df2e76ab696d11f80c93.tar.gz modlist-4e6466af1329f7b9e341df2e76ab696d11f80c93.zip |
version bump, cargo fmt and cargo update
Diffstat (limited to 'src/config.rs')
-rw-r--r-- | src/config.rs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/config.rs b/src/config.rs index 817d22b..61db1c7 100644 --- a/src/config.rs +++ b/src/config.rs | |||
@@ -1,11 +1,12 @@ | |||
1 | use std::{ | 1 | use std::{ |
2 | fs::{File, create_dir_all}, | 2 | fs::{create_dir_all, File}, |
3 | io::{Read, Write}, path::Path, | 3 | io::{Read, Write}, |
4 | path::Path, | ||
4 | }; | 5 | }; |
5 | 6 | ||
6 | use serde::{Deserialize, Serialize}; | 7 | use serde::{Deserialize, Serialize}; |
7 | 8 | ||
8 | use crate::{error::MLE, db::db_setup}; | 9 | use crate::{db::db_setup, error::MLE}; |
9 | 10 | ||
10 | #[derive(Debug, Clone, Serialize, Deserialize)] | 11 | #[derive(Debug, Clone, Serialize, Deserialize)] |
11 | pub struct Cfg { | 12 | pub struct Cfg { |
@@ -23,7 +24,11 @@ impl Cfg { | |||
23 | pub fn init(path: Option<String>) -> MLE<Self> { | 24 | pub fn init(path: Option<String>) -> MLE<Self> { |
24 | let configfile = match path.clone() { | 25 | let configfile = match path.clone() { |
25 | Some(p) => String::from(p), | 26 | Some(p) => String::from(p), |
26 | None => dirs::config_dir().unwrap().join("modlist.toml").to_string_lossy().to_string(), | 27 | None => dirs::config_dir() |
28 | .unwrap() | ||
29 | .join("modlist.toml") | ||
30 | .to_string_lossy() | ||
31 | .to_string(), | ||
27 | }; | 32 | }; |
28 | 33 | ||
29 | let mut file = match File::open(&configfile) { | 34 | let mut file = match File::open(&configfile) { |