Files
momentry_core/src/core/path_utils.rs
T
Accusys 63fbbe1225 release: v1.3.1 - Pipeline Queue Integration, OCR Fix, Worker Compatibility
Major Changes:
- Pipeline Queue integration completed (internal.file + pipeline.commands)
- Fixed old job_worker database compatibility with new command_queue table
- Compiled Swift OCR binary (was missing, causing empty OCR results)
- Added deep scan functionality through re-scan API

Fixes:
- Changed CommandJob.id from i32 to i64 for database compatibility
- Added UUID generation in create_command (message_id field)
- Fixed claim_pending_commands to query queue_name = 'internal.file'
- Fixed field mappings: command_id → message_id, job_type → command_type
- Added support for 'processing' status in CommandJobStatus

Queue System:
- internal.file queue: for register/unregister/re-scan commands (job_worker)
- pipeline.commands queue: for vectorize/store_asrx/etc commands (pipeline_worker)

Documentation:
- Added comprehensive queue system documentation
- Created M4 workspace status reports
- Updated AGENTS.md with queue system details
2026-10-12 10:00:51 +08:00

44 lines
1.3 KiB
Rust

use std::path::PathBuf;
/// Resolve asset path at runtime (not compile-time).
///
/// Priority:
/// 1. Explicit environment variable (e.g., MOMENTRY_SCRIPTS_DIR)
/// 2. Sibling of current_exe (same directory as running binary)
/// 3. Relative path fallback (dev machine)
///
/// This avoids CARGO_MANIFEST_DIR being baked into the binary at compile time,
/// which breaks on binary-only release hosts.
pub fn resolve_asset_path(env_var: &str, fallback_relative: &str) -> PathBuf {
std::env::var_os(env_var)
.map(PathBuf::from)
.filter(|p| p.exists())
.or_else(|| {
std::env::current_exe()
.ok()
.and_then(|p| p.parent().map(|d| d.join(fallback_relative)))
.filter(|p| p.exists())
})
.unwrap_or_else(|| PathBuf::from(fallback_relative))
}
/// Get scripts directory.
pub fn scripts_dir() -> PathBuf {
resolve_asset_path("MOMENTRY_SCRIPTS_DIR", "scripts")
}
/// Get CLI tools directory.
pub fn cli_dir() -> PathBuf {
resolve_asset_path("MOMENTRY_CLI_DIR", "tools/cli")
}
/// Get config directory.
pub fn config_dir() -> PathBuf {
resolve_asset_path("MOMENTRY_CONFIG_DIR", "config")
}
/// Get models directory.
pub fn models_dir() -> PathBuf {
resolve_asset_path("MOMENTRY_MODELS_DIR", "models")
}