diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/Cargo.toml | 1 | ||||
-rw-r--r-- | server/src/main.rs | 38 |
2 files changed, 21 insertions, 18 deletions
diff --git a/server/Cargo.toml b/server/Cargo.toml index 1ece357d..c12d5d9a 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -43,4 +43,3 @@ default = ["mdns", "register", "upnp"] mdns = ["dep:mdns-sd", "dep:get_if_addrs"] register = ["dep:reqwest"] upnp = ["dep:igd", "dep:get_if_addrs"] -flatpak = [] diff --git a/server/src/main.rs b/server/src/main.rs index d6e6f8f7..166a1dee 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -102,24 +102,28 @@ fn main() -> Result<()> { } else { let mut test_order = Vec::new(); - #[cfg(debug_assertions)] - test_order.push("data".to_string()); + if let Some(path) = option_env!("DATA_SEARCH_PATH") { + test_order.push(path.to_owned()); + } else { + #[cfg(debug_assertions)] + test_order.push("data".to_string()); - #[cfg(feature = "flatpak")] - test_order.push("/app/share/hurrycurry/data"); - - #[cfg(not(any(windows, feature = "flatpak")))] - test_order.extend([ - "/usr/local/share/hurrycurry/data".to_string(), - "/usr/share/hurrycurry/data".to_string(), - "/opt/hurrycurry/data".to_string(), - ]); + #[cfg(not(debug_assertions))] + { + #[cfg(not(windows))] + test_order.extend([ + "/usr/local/share/hurrycurry/data".to_string(), + "/usr/share/hurrycurry/data".to_string(), + "/opt/hurrycurry/data".to_string(), + ]); - #[cfg(windows)] - match read_windows_reg_datadir() { - Ok(path) => test_order.push(path), - Err(e) => warn!("Cannot find read datadir from windows registry: {e}"), - }; + #[cfg(windows)] + match read_windows_reg_datadir() { + Ok(path) => test_order.push(path), + Err(e) => warn!("Cannot find read datadir from windows registry: {e}"), + }; + } + } let Some(d) = test_order .iter() @@ -131,7 +135,7 @@ fn main() -> Result<()> { ); }; - info!("Detected data dir to be {d:?}"); + info!("Selected data dir {d:?}"); PathBuf::from_str(d)? }; *DATA_DIR.lock().unwrap() = Some(data_dir); |