Skip to content

Commit

Permalink
Feat(config.rs): Libraries Location File
Browse files Browse the repository at this point in the history
  • Loading branch information
WillKirkmanM committed Dec 21, 2024
1 parent 40e0a68 commit a6c82e1
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions crates/backend/src/utils/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,26 @@ pub fn get_config_path() -> PathBuf {
path
}

pub fn get_libraries_config_path() -> PathBuf {
let path = if is_docker() {
Path::new("/ParsonLabsMusic/Config/libraries.json").to_path_buf()
} else {
let mut path = dirs::data_local_dir().unwrap_or_else(|| PathBuf::from("."));
path.push("ParsonLabs");
path.push("Music");
path.push("Config");
path.push("libraries.json");
path
};

if let Some(parent) = path.parent() {
if let Err(e) = fs::create_dir_all(parent) {
eprintln!("Failed to create directories: {}", e);
}
}

path
}

#[get("/has_config")]
async fn has_config() -> impl Responder {
Expand Down

0 comments on commit a6c82e1

Please sign in to comment.