修复部分bug #34

This commit is contained in:
xaoyaoo 2023-12-03 17:48:39 +08:00
parent 7886a87791
commit 69ee8e77c1
2 changed files with 13 additions and 8 deletions

View File

@ -20,12 +20,17 @@ def get_wechat_db(require_list: Union[List[str], str] = "all", msg_dir: str = No
winreg.CloseKey(key)
w_dir = value
except Exception as e:
w_dir = "MyDocument:"
if w_dir == "MyDocument:":
# 获取文档实际目录
try:
# 打开注册表路径
key = winreg.OpenKey(winreg.HKEY_CURRENT_USER,
r"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders")
documents_path = winreg.QueryValueEx(key, "Personal")[0] # 读取文档实际目录路径
winreg.CloseKey(key) # 关闭注册表
w_dir = documents_path
except Exception as e:
profile = os.path.expanduser("~")
msg_dir = os.path.join(profile, "Documents", "WeChat Files")
else:
w_dir = os.path.join(profile, "Documents")
msg_dir = os.path.join(w_dir, "WeChat Files")
if not os.path.exists(msg_dir):

View File

@ -81,7 +81,7 @@ def get_info_filePath(wxid="all"):
# 获取文档实际目录
try:
# 打开注册表路径
key = winreg.OpenKey(winreg.HKEY_CURRENT_USER,"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders")
key = winreg.OpenKey(winreg.HKEY_CURRENT_USER,r"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders")
documents_path = winreg.QueryValueEx(key, "Personal")[0]# 读取文档实际目录路径
winreg.CloseKey(key) # 关闭注册表
w_dir = documents_path