修复部分bug #34
This commit is contained in:
parent
11860acbac
commit
86de31f274
@ -24,10 +24,15 @@ def get_wechat_db(require_list: Union[List[str], str] = "all", msg_dir: str = No
|
|||||||
try:
|
try:
|
||||||
# 打开注册表路径
|
# 打开注册表路径
|
||||||
key = winreg.OpenKey(winreg.HKEY_CURRENT_USER,
|
key = winreg.OpenKey(winreg.HKEY_CURRENT_USER,
|
||||||
r"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders")
|
r"Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders")
|
||||||
documents_path = winreg.QueryValueEx(key, "Personal")[0] # 读取文档实际目录路径
|
documents_path = winreg.QueryValueEx(key, "Personal")[0] # 读取文档实际目录路径
|
||||||
winreg.CloseKey(key) # 关闭注册表
|
winreg.CloseKey(key) # 关闭注册表
|
||||||
w_dir = documents_path
|
documents_paths = os.path.split(documents_path)
|
||||||
|
if "%" in documents_paths[0]:
|
||||||
|
w_dir = os.environ.get(documents_paths[0].replace("%", ""))
|
||||||
|
w_dir = os.path.join(w_dir, os.path.join(*documents_paths[1:]))
|
||||||
|
else:
|
||||||
|
w_dir = documents_path
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
profile = os.path.expanduser("~")
|
profile = os.path.expanduser("~")
|
||||||
w_dir = os.path.join(profile, "Documents")
|
w_dir = os.path.join(profile, "Documents")
|
||||||
|
@ -81,14 +81,20 @@ def get_info_filePath(wxid="all"):
|
|||||||
# 获取文档实际目录
|
# 获取文档实际目录
|
||||||
try:
|
try:
|
||||||
# 打开注册表路径
|
# 打开注册表路径
|
||||||
key = winreg.OpenKey(winreg.HKEY_CURRENT_USER,r"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders")
|
key = winreg.OpenKey(winreg.HKEY_CURRENT_USER,r"Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders")
|
||||||
documents_path = winreg.QueryValueEx(key, "Personal")[0]# 读取文档实际目录路径
|
documents_path = winreg.QueryValueEx(key, "Personal")[0]# 读取文档实际目录路径
|
||||||
winreg.CloseKey(key) # 关闭注册表
|
winreg.CloseKey(key) # 关闭注册表
|
||||||
w_dir = documents_path
|
documents_paths = os.path.split(documents_path)
|
||||||
|
if "%" in documents_paths[0]:
|
||||||
|
w_dir = os.environ.get(documents_paths[0].replace("%",""))
|
||||||
|
w_dir = os.path.join(w_dir,os.path.join(*documents_paths[1:]))
|
||||||
|
else:
|
||||||
|
w_dir = documents_path
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
profile = os.path.expanduser("~")
|
profile = os.path.expanduser("~")
|
||||||
w_dir = os.path.join(profile, "Documents")
|
w_dir = os.path.join(profile, "Documents")
|
||||||
msg_dir = os.path.join(w_dir, "WeChat Files")
|
msg_dir = os.path.join(w_dir, "WeChat Files")
|
||||||
|
|
||||||
if wxid == "all" and os.path.exists(msg_dir):
|
if wxid == "all" and os.path.exists(msg_dir):
|
||||||
return msg_dir
|
return msg_dir
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user