mirror of
https://github.com/jackwener/wx-cli.git
synced 2026-10-08 20:05:46 +00:00
feat(windows): resolve MyDocument: token in Weixin data-root ini
The data-root ini under %APPDATA%\Tencent\xwechat\config\*.ini is observed to contain either a plain absolute path (e.g. D:\WeChatFiles) or the literal token 'MyDocument:'. The token form is not a real filesystem path, so detect_db_dir_impl() — which previously did PathBuf::from(content).is_dir() — silently failed on it, even though the user's Weixin data was sitting in their (possibly relocated) Documents folder. Empirically the token denotes 'the calling user's Documents folder'. We resolve it via SHGetKnownFolderPath(FOLDERID_Documents), which honours the standard Windows shell-folder redirect (HKCU User Shell Folders\Personal), so users who moved Documents to e.g. D:\Documents now auto-detect correctly. Plain absolute paths still pass through unchanged. Adds Win32_UI_Shell + Win32_System_Com features to the windows crate (needed for SHGetKnownFolderPath and CoTaskMemFree).
This commit is contained in:
@@ -71,6 +71,8 @@ windows = { version = "0.58", features = [
|
||||
"Win32_System_Threading",
|
||||
"Win32_Foundation",
|
||||
"Win32_System_Memory",
|
||||
"Win32_System_Com",
|
||||
"Win32_UI_Shell",
|
||||
] }
|
||||
|
||||
[profile.release]
|
||||
|
||||
Reference in New Issue
Block a user