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:
Accusys
2026-10-04 13:44:40 +08:00
parent 3d363e6266
commit a3c3ed8dc1
850 changed files with 130339 additions and 91 deletions
+12 -12
View File
@@ -5,8 +5,8 @@
{
"tool": "rust",
"model": null,
"priority": 0,
"enabled": true,
"priority": 1,
"enabled": false,
"command": {
"executable": "tools/cli/rust/target/release/rust_pose",
"args": [
@@ -25,10 +25,10 @@
{
"tool": "swift",
"model": null,
"priority": 1,
"priority": 0,
"enabled": true,
"command": {
"executable": "tools/cli/swift/.build/release/swift_pose",
"executable": "scripts/swift_processors/.build/release/swift_pose",
"args": [
"{video_path}",
"--output",
@@ -116,7 +116,7 @@
{
"tool": "python",
"model": "facenet",
"priority": 1,
"priority": 2,
"enabled": true,
"command": {
"executable": "/opt/homebrew/bin/python3.11",
@@ -202,7 +202,7 @@
"tool": "swift",
"model": null,
"priority": 0,
"enabled": true,
"enabled": false,
"command": {
"executable": "scripts/swift_processors/.build/release/asrx_swift",
"args": [
@@ -220,7 +220,7 @@
{
"tool": "python",
"model": null,
"priority": 1,
"priority": 0,
"enabled": true,
"command": {
"executable": "/opt/homebrew/bin/python3.11",
@@ -266,7 +266,7 @@
{
"tool": "python",
"model": "tesseract",
"priority": 1,
"priority": 2,
"enabled": true,
"command": {
"executable": "/opt/homebrew/bin/python3.11",
@@ -345,7 +345,7 @@
"tool": "rust",
"model": "gemma-4-12b-it",
"priority": 0,
"enabled": false,
"enabled": true,
"command": {
"executable": "tools/cli/rust/target/release/rust_scene_vlm",
"args": [
@@ -361,7 +361,7 @@
},
"parameters": {
"llm_url": "http://localhost:8080/v1/chat/completions",
"max_tokens": 300
"max_tokens": 900
},
"output_file": "{file_uuid}.scene_vlm.json",
"timeout": 1800
@@ -370,7 +370,7 @@
"tool": "python",
"model": "gemma-4-12b-it",
"priority": 1,
"enabled": true,
"enabled": false,
"command": {
"executable": "/opt/homebrew/bin/python3.11",
"script": "scripts/scene_vlm_summary.py",
@@ -387,7 +387,7 @@
},
"parameters": {
"llm_url": "http://localhost:8080/v1/chat/completions",
"max_tokens": 300
"max_tokens": 900
},
"output_file": "{file_uuid}.scene_vlm.json",
"timeout": 1800