mirror of https://github.com/jackwener/wx-cli.git
fix(init): show config.json path in auto-detect error
When auto_detect_db_dir() fails, the error told the user to edit config.json without saying where that file lives. On Windows that is %USERPROFILE%\.wx-cli\config.json, which is non-obvious. Use the config_path already computed at the top of cmd_init() so the error message includes the absolute path, plus a concrete example of the db_dir shape.pull/77/head
parent
52cc39a55c
commit
7451ce5684
|
|
@ -35,8 +35,13 @@ pub fn cmd_init(force: bool) -> Result<()> {
|
||||||
|
|
||||||
// Step 1: 检测 db_dir
|
// Step 1: 检测 db_dir
|
||||||
println!("检测微信数据目录...");
|
println!("检测微信数据目录...");
|
||||||
let db_dir = config::auto_detect_db_dir()
|
let db_dir = config::auto_detect_db_dir().with_context(|| format!(
|
||||||
.context("未能自动检测到微信数据目录\n请手动编辑 config.json 中的 db_dir 字段")?;
|
"未能自动检测到微信数据目录\n\
|
||||||
|
请编辑配置文件并填写 db_dir 字段:\n \
|
||||||
|
{}\n\
|
||||||
|
(文件不存在则首次保存后自动创建;db_dir 示例: <data_root>\\xwechat_files\\<wxid>\\db_storage)",
|
||||||
|
config_path.display()
|
||||||
|
))?;
|
||||||
println!("找到数据目录: {}", db_dir.display());
|
println!("找到数据目录: {}", db_dir.display());
|
||||||
|
|
||||||
// Step 2: 扫描密钥(需要 root/sudo)
|
// Step 2: 扫描密钥(需要 root/sudo)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue