aboutsummaryrefslogtreecommitdiff
path: root/server/src
diff options
context:
space:
mode:
Diffstat (limited to 'server/src')
-rw-r--r--server/src/main.rs38
1 files changed, 20 insertions, 18 deletions
diff --git a/server/src/main.rs b/server/src/main.rs
index 166a1dee..ed2e5681 100644
--- a/server/src/main.rs
+++ b/server/src/main.rs
@@ -26,6 +26,7 @@ use hurrycurry_server::{
};
use log::{debug, info, trace, warn, LevelFilter};
use std::{
+ env::var,
net::SocketAddr,
path::PathBuf,
process::exit,
@@ -102,28 +103,29 @@ fn main() -> Result<()> {
} else {
let mut test_order = Vec::new();
+ if let Ok(path) = var("DATA_SEARCH_PATH") {
+ test_order.push(path);
+ }
+
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(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(debug_assertions)]
+ test_order.push("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}"),
+ };
+
+ #[cfg(not(windows))]
+ test_order.extend([
+ "/usr/local/share/hurrycurry/data".to_string(),
+ "/usr/share/hurrycurry/data".to_string(),
+ "/opt/hurrycurry/data".to_string(),
+ ]);
let Some(d) = test_order
.iter()