Skip to content

armgit / jan

Public Imported from GitHub
0

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.

fix: resolve bun path using the same mech as MCP

Vanalitefa95dfb82dbd
diff --git a/src-tauri/src/core/openclaw/mod.rs b/src-tauri/src/core/openclaw/mod.rs
index 73ae597c3..1c33436fe 100644
--- a/src-tauri/src/core/openclaw/mod.rs
+++ b/src-tauri/src/core/openclaw/mod.rs
@@ -80,10 +80,7 @@ pub fn get_openclaw_bin_path() -> Result<std::path::PathBuf, String> {
/// Resolve the bundled Bun path. Returns None if unavailable.
///
-/// Resolution order:
-/// 1. Next to executable (macOS, Windows, dev mode)
-/// 2. `$APPDIR/usr/bin/bun` (Linux AppImage — exe is in usr/lib/, bun is in usr/bin/)
-/// 3. `/usr/bin/bun` (Linux deb)
+/// Looks for bun next to the current executable (same approach as MCP).
pub fn resolve_bundled_bun() -> Option<std::path::PathBuf> {
let bun_name = if cfg!(target_os = "windows") { "bun.exe" } else { "bun" };
@@ -99,27 +96,6 @@ pub fn resolve_bundled_bun() -> Option<std::path::PathBuf> {
}
}
- #[cfg(target_os = "linux")]
- {
- if let Ok(appdir) = std::env::var("APPDIR") {
- let candidate = std::path::PathBuf::from(&appdir).join("usr").join("bin").join("bun");
- if candidate.exists() {
- let s = candidate.to_string_lossy().to_string();
- if jan_utils::system::can_override_npx(s) {
- return Some(candidate);
- }
- }
- }
-
- let system_bun = std::path::PathBuf::from("/usr/bin/bun");
- if system_bun.exists() {
- let s = system_bun.to_string_lossy().to_string();
- if jan_utils::system::can_override_npx(s) {
- return Some(system_bun);
- }
- }
- }
-
None
}