diff --git a/src/apps/desktop/src/api/terminal_api.rs b/src/apps/desktop/src/api/terminal_api.rs index 4995952d98..24962acde5 100644 --- a/src/apps/desktop/src/api/terminal_api.rs +++ b/src/apps/desktop/src/api/terminal_api.rs @@ -1,5 +1,6 @@ //! Terminal API +use bitfun_core::infrastructure::PathManager; use log::{error, warn}; use serde::{Deserialize, Serialize}; use std::path::PathBuf; @@ -72,8 +73,8 @@ impl TerminalState { /// Get the scripts directory path for shell integration /// Uses the same path structure as PathManager fn get_scripts_dir() -> PathBuf { - dirs::config_dir() - .unwrap_or_else(|| PathBuf::from(".")) + PathManager::new().map(|p| p.home_dir()) + .unwrap_or_else(|_| PathBuf::from(".")) .join("bitfun") .join("temp") .join("scripts") diff --git a/src/crates/core/src/service/terminal/src/shell/detection.rs b/src/crates/core/src/service/terminal/src/shell/detection.rs index e1dbd09aef..4b35573991 100644 --- a/src/crates/core/src/service/terminal/src/shell/detection.rs +++ b/src/crates/core/src/service/terminal/src/shell/detection.rs @@ -82,22 +82,21 @@ impl ShellDetector { #[cfg(not(windows))] { - if let Some(zsh_path) = Self::find_zsh_with_which() { - return DetectedShell { - shell_type: ShellType::Zsh, - path: zsh_path.clone(), - version: Self::get_shell_version(zsh_path.to_str().unwrap_or_default()), - display_name: "zsh".to_string(), - }; - } else if let Some(bash_path) = Self::find_bash_with_which() { + if let Some(bash_path) = Self::find_bash_with_which() { return DetectedShell { shell_type: ShellType::Bash, path: bash_path.clone(), version: Self::get_shell_version(bash_path.to_str().unwrap_or_default()), display_name: "bash".to_string(), }; - } - { + } else if let Some(zsh_path) = Self::find_zsh_with_which() { + return DetectedShell { + shell_type: ShellType::Zsh, + path: zsh_path.clone(), + version: Self::get_shell_version(zsh_path.to_str().unwrap_or_default()), + display_name: "zsh".to_string(), + }; + } else { log::error!("bash not found"); } // Try to use $SHELL environment variable @@ -304,6 +303,7 @@ impl ShellDetector { PathBuf::from(format!("/usr/local/bin/{}", executable)), PathBuf::from(format!("/usr/bin/{}", executable)), PathBuf::from(format!("/bin/{}", executable)), + PathBuf::from(format!("/data/service/hnp/bin/{}", executable)), ]; for path in candidates {