From f152513eb2ff505deb2a03485a0c492f7b09ef3f Mon Sep 17 00:00:00 2001 From: dynilath Date: Sun, 4 Apr 2021 19:23:49 +0800 Subject: [PATCH] fix: documents location may not be default --- tts/filesystem.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tts/filesystem.py b/tts/filesystem.py index 4cb8635..5a55f20 100644 --- a/tts/filesystem.py +++ b/tts/filesystem.py @@ -4,10 +4,17 @@ import platform if platform.system() == 'Linux': import xdgappdirs +elif platform.system() == 'Windows': + import ctypes.wintypes def standard_basepath(): if platform.system() == 'Windows': - basepath = os.path.join(os.path.expanduser("~"),"Documents","My Games","Tabletop Simulator") + buf = ctypes.create_unicode_buffer(ctypes.wintypes.MAX_PATH) + CSIDL_PERSONAL = 5 + SHGFP_TYPE_CURRENT = 0 + ctypes.windll.shell32.SHGetFolderPathW(None, CSIDL_PERSONAL, None, SHGFP_TYPE_CURRENT, buf) + + basepath = os.path.join(buf.value,"My Games","Tabletop Simulator") elif platform.system() == 'Linux': basepath = os.path.join(xdgappdirs.user_data_dir(),"Tabletop Simulator") else: