mirror of
https://github.com/qingchencloud/clawpanel.git
synced 2026-07-12 16:01:56 +08:00
- dashboard.js: 版本/状态信息持久化缓存,实例切换时自动清空 (#145) - service.rs: macOS is_cli_installed 改为真实路径探测,无plist时返回默认Gateway条目 (#144) - utils.rs: 新增 common_non_windows_cli_candidates,resolve_openclaw_cli_path 优先检测 standalone/手动安装路径 (#144) - config.rs: macOS get_local_version 增加 resolve_cli + canonicalize,detect_installed_source 增加 CLI 分类 + standalone 检测 (#144) - dev-api.js: macOS CLI/版本/来源检测补齐 Intel Homebrew + standalone + findOpenclawBin (#144) - main.js: 更新 banner dismiss 从 sessionStorage 改 localStorage (#146) - assistant.js: Web 模式 AI 测试走后端代理 api.testModel 绕过 CORS (#148)
This commit is contained in:
@@ -35,6 +35,20 @@ fn find_openclaw_cmd() -> Option<std::path::PathBuf> {
|
||||
None
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
fn common_non_windows_cli_candidates() -> Vec<std::path::PathBuf> {
|
||||
let mut candidates = Vec::new();
|
||||
if let Some(home) = dirs::home_dir() {
|
||||
candidates.push(home.join(".openclaw-bin").join("openclaw"));
|
||||
candidates.push(home.join(".local").join("bin").join("openclaw"));
|
||||
}
|
||||
candidates.push(std::path::PathBuf::from("/opt/openclaw/openclaw"));
|
||||
candidates.push(std::path::PathBuf::from("/opt/homebrew/bin/openclaw"));
|
||||
candidates.push(std::path::PathBuf::from("/usr/local/bin/openclaw"));
|
||||
candidates.push(std::path::PathBuf::from("/usr/bin/openclaw"));
|
||||
candidates
|
||||
}
|
||||
|
||||
/// 解析当前实际使用的 openclaw CLI 完整路径(跨平台)
|
||||
pub fn resolve_openclaw_cli_path() -> Option<String> {
|
||||
// 优先使用用户绑定的路径
|
||||
@@ -54,6 +68,11 @@ pub fn resolve_openclaw_cli_path() -> Option<String> {
|
||||
}
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
{
|
||||
for candidate in common_non_windows_cli_candidates() {
|
||||
if candidate.exists() {
|
||||
return Some(candidate.to_string_lossy().to_string());
|
||||
}
|
||||
}
|
||||
let path = crate::commands::enhanced_path();
|
||||
let sep = ':';
|
||||
for dir in path.split(sep) {
|
||||
|
||||
Reference in New Issue
Block a user