mirror of
https://github.com/qingchencloud/clawpanel.git
synced 2026-08-07 06:33:58 +08:00
fix(ci): compile Hermes sync transaction on Unix
This commit is contained in:
@@ -3112,7 +3112,9 @@ fn replace_hermes_files_transaction(entries: &[(PathBuf, String, bool)]) -> Resu
|
||||
);
|
||||
let mut staged: Vec<(PathBuf, PathBuf, PathBuf, bool, bool)> = Vec::new();
|
||||
|
||||
for (file, content, _private) in entries {
|
||||
for (file, content, private) in entries {
|
||||
#[cfg(not(unix))]
|
||||
let _ = private;
|
||||
if let Some(parent) = file.parent() {
|
||||
std::fs::create_dir_all(parent)
|
||||
.map_err(|e| format!("创建 Hermes 配置目录失败: {e}"))?;
|
||||
@@ -3120,7 +3122,7 @@ fn replace_hermes_files_transaction(entries: &[(PathBuf, String, bool)]) -> Resu
|
||||
let temp = file.with_extension(format!("tmp-{suffix}"));
|
||||
let backup = file.with_extension(format!("bak-sync-{suffix}"));
|
||||
std::fs::write(&temp, content).map_err(|e| format!("写入临时配置失败: {e}"))?;
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
#[cfg(unix)]
|
||||
if *private {
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
std::fs::set_permissions(&temp, std::fs::Permissions::from_mode(0o600))
|
||||
|
||||
@@ -39,3 +39,10 @@ test('Hermes Rust 与 Web 关键 Provider 注册表保持一致', () => {
|
||||
assert.match(rust, /id:\s*"alibaba",[\s\S]*?name:\s*"Qwen Cloud"/)
|
||||
assert.match(web, /hermesProvider\('alibaba',\s*'Qwen Cloud'/)
|
||||
})
|
||||
|
||||
test('Hermes 配置事务的私密权限标记可跨平台编译', () => {
|
||||
const rust = read('src-tauri/src/commands/hermes.rs')
|
||||
assert.match(rust, /for \(file, content, private\) in entries/)
|
||||
assert.match(rust, /#\[cfg\(unix\)\][\s\S]*?if \*private/)
|
||||
assert.match(rust, /#\[cfg\(not\(unix\)\)\][\s\S]*?let _ = private;/)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user