mirror of
https://github.com/LC044/WeChatMsg
synced 2025-02-23 03:22:17 +08:00
修复找不到微信路径的问题#50
This commit is contained in:
parent
3aef688808
commit
58445d26b8
@ -23,21 +23,25 @@ def mkdir(path):
|
|||||||
|
|
||||||
|
|
||||||
def wx_path():
|
def wx_path():
|
||||||
## 获取当前用户名
|
try:
|
||||||
user_home = os.environ.get("USERPROFILE")
|
## 获取当前用户名
|
||||||
## 找到3ebffe94.ini配置文件
|
user_home = os.environ.get("USERPROFILE")
|
||||||
f = open(user_home + '\\AppData\\Roaming\\Tencent\\WeChat\\All Users\\config\\3ebffe94.ini', encoding='utf-8')
|
## 找到3ebffe94.ini配置文件
|
||||||
txt = f.read()
|
f = open(user_home + '\\AppData\\Roaming\\Tencent\\WeChat\\All Users\\config\\3ebffe94.ini', encoding='utf-8')
|
||||||
f.close()
|
txt = f.read()
|
||||||
# 打开Windows注册表
|
f.close()
|
||||||
reg_key = winreg.OpenKey(winreg.HKEY_CURRENT_USER,
|
# 打开Windows注册表
|
||||||
"Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders")
|
reg_key = winreg.OpenKey(winreg.HKEY_CURRENT_USER,
|
||||||
# 获取“我的文档”路径的注册表键值
|
"Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders")
|
||||||
documents_path_value = winreg.QueryValueEx(reg_key, "Personal")
|
# 获取“我的文档”路径的注册表键值
|
||||||
# 输出路径
|
documents_path_value = winreg.QueryValueEx(reg_key, "Personal")
|
||||||
##读取文件将路径放到wx_location变量里
|
# 输出路径
|
||||||
if txt == 'MyDocument:':
|
##读取文件将路径放到wx_location变量里
|
||||||
wx_location = documents_path_value[0] + '\WeChat Files'
|
if txt == 'MyDocument:':
|
||||||
else:
|
wx_location = documents_path_value[0] + '\WeChat Files'
|
||||||
wx_location = txt + "\WeChat Files"
|
else:
|
||||||
return wx_location
|
wx_location = txt + "\WeChat Files"
|
||||||
|
return wx_location
|
||||||
|
except FileNotFoundError:
|
||||||
|
return '.'
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user