From 80c691a578b6cbb37387968b2fb5583fa125a162 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <1173718158@qq.com> Date: Sun, 1 Dec 2024 12:50:28 +0800 Subject: [PATCH] . --- py/LunaTranslator/myutils/hwnd.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/py/LunaTranslator/myutils/hwnd.py b/py/LunaTranslator/myutils/hwnd.py index e61c3c30..7c8fd249 100644 --- a/py/LunaTranslator/myutils/hwnd.py +++ b/py/LunaTranslator/myutils/hwnd.py @@ -48,15 +48,9 @@ def grabwindow(app="PNG", callback_origin=None, tocliponly=False): os.makedirs(dirname, exist_ok=True) fname = os.path.join(dirname, tmsp) except: - fnamebase = "cache/screenshot" - if not os.path.exists(fnamebase): - fnamebase = windows.SHGetFolderPathW(windows.CSIDL_MYPICTURES) - if not (fnamebase and os.path.exists(fnamebase)): - fnamebase = "cache/screenshot" - else: - fnamebase = os.path.join(fnamebase, "LunaTranslator") - fname = os.path.join(fnamebase, exename, tmsp) - os.makedirs(os.path.join(fnamebase, exename), exist_ok=True) + fname = gobject.getcachedir( + "screenshot/{}/{}".format(exename, tmsp), abspath=False + ) def callback_1(callback_origin, uid, tocliponly, p: QPixmap, fn): if p.isNull():