适配windows环境变量

sender_okToCheck
Timmoc 3 months ago
parent 632981180a
commit 9bd045678e

@ -1,3 +1,4 @@
import os
import sys
import winreg
from pathlib import Path
@ -13,8 +14,8 @@ def get_download_directory():
# 读取 "Downloads" 路径
download_dir, _ = winreg.QueryValueEx(key, '{374DE290-123F-4565-9164-39C4925E467B}')
# 将路径从注册表中的格式转换为标准格式
download_dir = Path(download_dir).resolve()
# 展开环境变量并转换为标准格式
download_dir = Path(os.path.expandvars(download_dir)).resolve()
finally:
# 关闭注册表项

Loading…
Cancel
Save