1 diff --git a/src/main.rs b/src/main.rs
2 index 357a33b..7073497 100644
7 +use std::path::PathBuf;
11 @@ -8,12 +8,23 @@ fn main() -> Result<(), std::io::Error> {
15 - let mut config_path = env::current_exe()?;
17 - config_path.push("uni-sync.json");
18 + let mut config_path = PathBuf::from("/etc/uni-sync/uni-sync.json");
20 if !config_path.exists() {
21 - std::fs::write(&config_path, serde_json::to_string_pretty(&configs).unwrap())?;
22 + match std::fs::create_dir_all(config_path.parent().unwrap()) {
23 + Ok(result) => result,
25 + println!("Please run uni-sync with elevated permissions.");
26 + std::process::exit(0);
29 + match std::fs::write(&config_path, serde_json::to_string_pretty(&configs).unwrap()) {
30 + Ok(result) => result,
32 + println!("Please run uni-sync with elevated permissions.");
33 + std::process::exit(0);
38 let config_content = std::fs::read_to_string(&config_path).unwrap();