fix: complete tools.rs path cleanup (A-4.2 P3)

Issues: 3 hardcoded paths

Solution: Use config::OUTPUT_DIR and path_utils::scripts_dir()

Verification: cargo check --lib passes, 0 hardcoded paths
This commit is contained in:
Accusys
2026-10-04 16:37:09 +08:00
parent 6c95404a30
commit 0afb90e26a
+3 -6
View File
@@ -1218,10 +1218,8 @@ pub async fn exec_search_by_appearance(
.to_string(),
)?;
let output_dir = std::env::var("MOMENTRY_OUTPUT_DIR")
.unwrap_or_else(|_| "/Users/accusys/momentry/output".to_string());
let scripts_dir = std::env::var("MOMENTRY_SCRIPTS_DIR")
.unwrap_or_else(|_| "/Users/accusys/momentry_core/scripts".to_string());
let output_dir = crate::core::config::OUTPUT_DIR.to_string();
let scripts_dir = crate::core::path_utils::scripts_dir().to_string_lossy().to_string();
let script_path = format!("{}/clothing_color_search.py", scripts_dir);
let appearance_path = format!("{}/{}.appearance.json", output_dir, file_uuid);
let output_path = format!("{}/{}.color_search_{}.json", output_dir, file_uuid, color);
@@ -1280,8 +1278,7 @@ pub async fn exec_search_by_appearance(
}
fn face_crop_path(file_uuid: &str, trace_id: i32) -> Option<std::path::PathBuf> {
let base = std::env::var("MOMENTRY_OUTPUT_DIR")
.unwrap_or_else(|_| "/Users/accusys/momentry/output".to_string());
let base = crate::core::config::OUTPUT_DIR.to_string();
let dir = std::path::PathBuf::from(base)
.join(".faces")
.join(file_uuid)