Skip to content

FinceptTerminal is a modern finance application offering advanced market analytics, investment research, and economic data tools, designed for interactive exploration and data-driven decision-making in a user-friendly environment.

Fix macOS Python script path resolution

tilakpatel2265a7b28ae3b0
diff --git a/fincept-terminal-desktop/src-tauri/src/commands/agents.rs b/fincept-terminal-desktop/src-tauri/src/commands/agents.rs
index eea350121..a6d361413 100644
--- a/fincept-terminal-desktop/src-tauri/src/commands/agents.rs
+++ b/fincept-terminal-desktop/src-tauri/src/commands/agents.rs
@@ -246,7 +246,7 @@ pub async fn execute_python_agent(
} else {
let resource_dir = app.path().resource_dir()
.map_err(|e| format!("Failed to get resource directory: {}", e))?;
- resource_dir.join("resources").join("scripts").join(script_path)
+ resource_dir.join("scripts").join(script_path)
};
if !full_script_path.exists() {
@@ -324,7 +324,7 @@ pub async fn list_available_agents(app: tauri::AppHandle) -> Result<Vec<AgentMet
];
for (folder, config_file, category_id, icon, color) in categories {
- let config_path = format!("resources/scripts/agents/{}/configs/{}", folder, config_file);
+ let relative_path = format!("scripts/agents/{}/configs/{}", folder, config_file);
let full_path = if cfg!(debug_assertions) {
let current_dir = std::env::current_dir()
@@ -334,11 +334,11 @@ pub async fn list_available_agents(app: tauri::AppHandle) -> Result<Vec<AgentMet
} else {
current_dir.join("src-tauri")
};
- base_dir.join(&config_path)
+ base_dir.join("resources").join(&relative_path)
} else {
let resource_dir = app.path().resource_dir()
.map_err(|e| format!("Failed to get resource directory: {}", e))?;
- resource_dir.join(&config_path)
+ resource_dir.join(&relative_path)
};
if let Ok(content) = std::fs::read_to_string(&full_path) {
@@ -386,7 +386,7 @@ pub async fn read_agent_config(
category: String,
config_file: String,
) -> Result<String, String> {
- let config_path = format!("resources/scripts/agents/{}/configs/{}", category, config_file);
+ let relative_path = format!("scripts/agents/{}/configs/{}", category, config_file);
let full_path = if cfg!(debug_assertions) {
let current_dir = std::env::current_dir()
@@ -396,11 +396,11 @@ pub async fn read_agent_config(
} else {
current_dir.join("src-tauri")
};
- base_dir.join(&config_path)
+ base_dir.join("resources").join(&relative_path)
} else {
let resource_dir = app.path().resource_dir()
.map_err(|e| format!("Failed to get resource directory: {}", e))?;
- resource_dir.join(&config_path)
+ resource_dir.join(&relative_path)
};
std::fs::read_to_string(&full_path)
diff --git a/fincept-terminal-desktop/src-tauri/src/commands/alpha_arena.rs b/fincept-terminal-desktop/src-tauri/src/commands/alpha_arena.rs
index 8898aa68a..b0c7d6d0a 100644
--- a/fincept-terminal-desktop/src-tauri/src/commands/alpha_arena.rs
+++ b/fincept-terminal-desktop/src-tauri/src/commands/alpha_arena.rs
@@ -74,7 +74,7 @@ async fn execute_alpha_arena_action(action: &str, params: Value, api_keys: Optio
std::env::current_dir()
.ok()
.map(|d| d.join("resources").join("scripts").join(python_script_parts[0]).join(python_script_parts[1])),
- // Also check for bundled resources in release builds
+ // Check for bundled resources in release builds
std::env::current_exe()
.ok()
.and_then(|p| p.parent().map(|d| d.to_path_buf()))
diff --git a/fincept-terminal-desktop/src-tauri/src/utils/python.rs b/fincept-terminal-desktop/src-tauri/src/utils/python.rs
index d8015b0d6..dd0ee3f13 100644
--- a/fincept-terminal-desktop/src-tauri/src/utils/python.rs
+++ b/fincept-terminal-desktop/src-tauri/src/utils/python.rs
@@ -222,8 +222,11 @@ pub fn get_script_path(app: &tauri::AppHandle, script_name: &str) -> Result<Path
}
// Try each candidate path
- for path in candidate_paths.iter() {
+ eprintln!("[SCRIPT_PATH_DEBUG] Searching for: {}", script_name);
+ for (i, path) in candidate_paths.iter().enumerate() {
+ eprintln!("[SCRIPT_PATH_DEBUG] Candidate {}: {:?}", i+1, path);
if path.exists() {
+ eprintln!("[SCRIPT_PATH_DEBUG] Found at candidate {}", i+1);
// Strip the \\?\ prefix that Python can't handle on Windows
let path_str = path.to_string_lossy().to_string();
let clean_path = if path_str.starts_with(r"\\?\") {