mirror of
https://git.axenov.dev/mirrors/cursor-free-vip.git
synced 2026-01-03 17:29:04 +03:00
修正 windows 环境下用户目录的获取方式
This commit is contained in:
@@ -32,7 +32,13 @@ EMOJI = {
|
||||
def get_user_documents_path():
|
||||
"""Get user Documents folder path"""
|
||||
if sys.platform == "win32":
|
||||
return os.path.join(os.path.expanduser("~"), "Documents")
|
||||
try:
|
||||
import winreg
|
||||
with winreg.OpenKey(winreg.HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders") as key:
|
||||
documents_path, _ = winreg.QueryValueEx(key, "Personal")
|
||||
return documents_path
|
||||
except Exception as e:
|
||||
return os.path.join(os.path.expanduser("~"), "Documents")
|
||||
elif sys.platform == "darwin":
|
||||
return os.path.join(os.path.expanduser("~"), "Documents")
|
||||
else: # Linux
|
||||
|
||||
Reference in New Issue
Block a user