sections
This commit is contained in:
parent
d54a367fa0
commit
d0d9f34f9e
@ -90,12 +90,13 @@ impl Configuration {
|
|||||||
pub fn new() -> Result<Self, io::Error> {
|
pub fn new() -> Result<Self, io::Error> {
|
||||||
let project_dirs =
|
let project_dirs =
|
||||||
ProjectDirs::from(APP_IDENTIFIER[0], APP_IDENTIFIER[1], APP_IDENTIFIER[2]).unwrap();
|
ProjectDirs::from(APP_IDENTIFIER[0], APP_IDENTIFIER[1], APP_IDENTIFIER[2]).unwrap();
|
||||||
|
|
||||||
|
// Config dir
|
||||||
let config_dir = project_dirs.config_dir();
|
let config_dir = project_dirs.config_dir();
|
||||||
let _ = fs::create_dir_all(config_dir);
|
|
||||||
let config_file_path = config_dir.join(JSON_CONFIG_FILENAME).to_path_buf();
|
let config_file_path = config_dir.join(JSON_CONFIG_FILENAME).to_path_buf();
|
||||||
|
let _ = fs::create_dir_all(config_dir);
|
||||||
|
// Read/create config
|
||||||
let configuration = Conf::new(&config_file_path)?;
|
let configuration = Conf::new(&config_file_path)?;
|
||||||
|
|
||||||
fs::write(
|
fs::write(
|
||||||
&config_file_path,
|
&config_file_path,
|
||||||
serde_json::to_string(&configuration).unwrap(),
|
serde_json::to_string(&configuration).unwrap(),
|
||||||
|
Loading…
Reference in New Issue
Block a user