mirror of https://github.com/jackwener/wx-cli.git
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.rspull/43/head
parent
107af74a72
commit
521c6296b6
|
|
@ -121,7 +121,10 @@ fn start_daemon() -> Result<()> {
|
||||||
|
|
||||||
// 预检:当前用户是否能写 ~/.wx-cli/。如果不能,给出可操作的错误信息,
|
// 预检:当前用户是否能写 ~/.wx-cli/。如果不能,给出可操作的错误信息,
|
||||||
// 而不是 spawn 一个注定失败的 daemon 然后超时 15s。
|
// 而不是 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)]
|
#[cfg(unix)]
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ pub async fn start_daemon(tcp_addr: Option<String>) -> Result<()> {
|
||||||
// 收集消息 DB 列表
|
// 收集消息 DB 列表
|
||||||
let msg_db_keys: Vec<String> = all_keys.keys()
|
let msg_db_keys: Vec<String> = all_keys.keys()
|
||||||
.filter(|k| {
|
.filter(|k| {
|
||||||
let k = k.replace('\', "/");
|
let k = k.replace('\\', "/");
|
||||||
k.contains("message/message_") && k.ends_with(".db")
|
k.contains("message/message_") && k.ends_with(".db")
|
||||||
&& !k.contains("_fts") && !k.contains("_resource")
|
&& !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() {
|
if !enc_key.is_empty() {
|
||||||
// 统一路径分隔符
|
// 统一路径分隔符
|
||||||
let rel = k.replace('\', "/");
|
let rel = k.replace('\\', "/");
|
||||||
result.insert(rel, enc_key);
|
result.insert(rel, enc_key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue