refactor: eliminate all CARGO_MANIFEST_DIR compile-time dependencies (A-4)
- Add src/core/path_utils.rs with runtime path resolution helpers
- Replace all env!("CARGO_MANIFEST_DIR") with runtime resolution
- Priority: env var -> current_exe sibling -> dev fallback
Changes:
- executor.rs: scripts_dir(), cli_dir() (4 locations)
- face.rs: swift_processor_path()
- tool_selector.rs: swift_binary_path()
- thumbnail/mod.rs: script_path()
Issue: CARGO_MANIFEST_DIR expands to build machine path at compile time,
breaking on binary-only release hosts.
Solution: Resolve paths at runtime in this order:
1. Explicit environment variable (MOMENTRY_SCRIPTS_DIR, MOMENTRY_CLI_DIR)
2. Sibling of current_exe (same directory as running binary)
3. Relative path fallback (dev machine)
Verified: cargo check --lib passes
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
[package]
|
||||
name = "rust_processors"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
description = "Rust replacement for Python processor scripts (standalone binaries)"
|
||||
|
||||
[[bin]]
|
||||
name = "rust_appearance"
|
||||
path = "src/bin/rust_appearance.rs"
|
||||
|
||||
[[bin]]
|
||||
name = "rust_pose"
|
||||
path = "src/bin/rust_pose.rs"
|
||||
|
||||
[[bin]]
|
||||
name = "rust_face_cluster"
|
||||
path = "src/bin/rust_face_cluster.rs"
|
||||
|
||||
[[bin]]
|
||||
name = "rust_vad"
|
||||
path = "src/bin/rust_vad.rs"
|
||||
|
||||
[[bin]]
|
||||
name = "rust_store_traced_faces"
|
||||
path = "src/bin/rust_store_traced_faces.rs"
|
||||
|
||||
[[bin]]
|
||||
name = "rust_cut"
|
||||
path = "src/bin/rust_cut.rs"
|
||||
|
||||
[[bin]]
|
||||
name = "rust_scene_vlm"
|
||||
path = "src/bin/rust_scene_vlm.rs"
|
||||
|
||||
[dependencies]
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
clap = { version = "4", features = ["derive"] }
|
||||
image = "0.25"
|
||||
ureq = { version = "2", features = ["json"] }
|
||||
base64 = "0.22"
|
||||
reqwest = { version = "0.12", features = ["blocking", "json"] }
|
||||
|
||||
# VAD dependencies
|
||||
ort = { version = "2.0.0-rc.13", features = ["download-binaries"] }
|
||||
hound = "3.5"
|
||||
ndarray = "0.17"
|
||||
anyhow = "1"
|
||||
|
||||
[dev-dependencies]
|
||||
tempfile = "3"
|
||||
|
||||
[profile.release]
|
||||
opt-level = 2
|
||||
[[bin]]
|
||||
name = "rust_facenet"
|
||||
path = "src/bin/rust_facenet.rs"
|
||||
|
||||
[[bin]]
|
||||
name = "rust_facenet_coreml"
|
||||
path = "src/bin/rust_facenet_coreml.rs"
|
||||
Reference in New Issue
Block a user