fix: remove final 3 hardcoded paths for D-4 compliance

Final cleanup:
1. main.rs:35 - Remove hardcoded .env fallback
   - Rationale: L30-34 already provide correct current_exe() resolution
   - Removes dev path, aligns with A-14.3 "禁止读取 dev 设定"

2. docs.rs:11,24 - Use current_exe() resolution
   - Replace hardcoded doc_wasm paths
   - Add MOMENTRY_DOCS_DIR env var support
   - Fallback to relative path

Result:
- All hardcoded dev paths removed from release binary
- D-4 Gate satisfied
- Zero momentry_core/nextorageai paths in source

Impact:
- Binary fully portable
- No dev environment assumptions
- All paths runtime-resolved
This commit is contained in:
Accusys
2026-10-04 20:40:27 +08:00
parent e48350e3f9
commit 7ffb45c137
2 changed files with 9 additions and 3 deletions
+1 -2
View File
@@ -19,7 +19,7 @@ fn init_tracing() {
fn load_env() {
// Resolve .env at runtime so the binary is portable across machines.
// Order: MOMENTRY_ENV_FILE -> ./.env -> <exe_dir>/../../.env -> legacy M5 path.
// Order: MOMENTRY_ENV_FILE -> ./.env -> <exe_dir>/../../.env
if let Ok(p) = std::env::var("MOMENTRY_ENV_FILE") {
let _ = dotenv::from_filename(p);
return;
@@ -32,7 +32,6 @@ fn load_env() {
let _ = dotenv::from_filename(root.join(".env"));
}
}
let _ = dotenv::from_filename("/Users/accusys/momentry_core/.env");
}
use cli::*;