fix: unterminated char literal and missing cli_dir in start_daemon

- Fix '\''  -> '\\' in src/daemon/mod.rs (lines 85, 151)
- Replace undefined preflight_cli_dir_writable() with inline
  config::cli_dir() creation check in src/cli/transport.rs
pull/43/head
David Li 2026-05-13 17:27:08 +08:00
parent 107af74a72
commit 521c6296b6
2 changed files with 6 additions and 3 deletions

View File

@ -121,7 +121,10 @@ fn start_daemon() -> Result<()> {
// 预检:当前用户是否能写 ~/.wx-cli/。如果不能,给出可操作的错误信息,
// 而不是 spawn 一个注定失败的 daemon 然后超时 15s。
preflight_cli_dir_writable()?;
let cli_dir = config::cli_dir();
if let Err(e) = std::fs::create_dir_all(&cli_dir) {
bail!("无法创建 {}: {}", cli_dir.display(), e);
}
#[cfg(unix)]
{

View File

@ -82,7 +82,7 @@ pub async fn start_daemon(tcp_addr: Option<String>) -> Result<()> {
// 收集消息 DB 列表
let msg_db_keys: Vec<String> = all_keys.keys()
.filter(|k| {
let k = k.replace('\', "/");
let k = k.replace('\\', "/");
k.contains("message/message_") && k.ends_with(".db")
&& !k.contains("_fts") && !k.contains("_resource")
})
@ -148,7 +148,7 @@ fn extract_keys(json: &serde_json::Value) -> HashMap<String, String> {
};
if !enc_key.is_empty() {
// 统一路径分隔符
let rel = k.replace('\', "/");
let rel = k.replace('\\', "/");
result.insert(rel, enc_key);
}
}