Put the world path in the configuration file
[valheim_web.git] / backend / src / valheim_controller.rs
index c09f080..a483756 100644 (file)
@@ -45,9 +45,8 @@ fn format_byte_size(bytes: u64, precision: usize) -> String {
 }\r
 \r
 const VALHEIM_PROCESS_NAME: &str = "valheim_server";\r
-const VALHEIM_WORLD_PATH: &str = "/home/greg/ValheimWorld/pouet.db"; // TODO: Put in conf.\r
 \r
-pub fn get_valheim_executable_information() -> Option<ValheimExe> {\r
+pub fn get_valheim_executable_information(world_path : &str) -> Option<ValheimExe> {\r
     let mut system = sysinfo::System::new_all();\r
     system.refresh_system();\r
     let processes = system.get_process_by_name(VALHEIM_PROCESS_NAME);\r
@@ -55,7 +54,7 @@ pub fn get_valheim_executable_information() -> Option<ValheimExe> {
     if processes.len() >= 1 {\r
         let process = processes.first().unwrap();\r
 \r
-        let world_size = match std::fs::metadata(VALHEIM_WORLD_PATH) { Ok(f) => f.len(), Err(_) => 0u64 };\r
+        let world_size = match std::fs::metadata(world_path) { Ok(f) => f.len(), Err(_) => 0u64 };\r
 \r
         Some(\r
             ValheimExe {\r