mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-28 08:04:13 +08:00
clear cache
This commit is contained in:
parent
6d88c762ac
commit
dab708894e
@ -24,6 +24,7 @@ from gui.rangeselect import rangeselct_function
|
||||
from gui.usefulwidget import resizableframeless, isinrect
|
||||
from gui.dialog_savedgame import browserdialog
|
||||
from gui.edittext import edittrans
|
||||
import shutil
|
||||
|
||||
|
||||
class QUnFrameWindow(resizableframeless):
|
||||
@ -1049,6 +1050,17 @@ class QUnFrameWindow(resizableframeless):
|
||||
button.belong = belong
|
||||
self.buttons[name] = button
|
||||
|
||||
def tryremoveuseless(self):
|
||||
|
||||
try:
|
||||
shutil.rmtree("./cache/temp")
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
os.remove("./cache/Updater.exe")
|
||||
except:
|
||||
pass
|
||||
|
||||
def closeEvent(self, a0) -> None:
|
||||
if self.fullscreenmanager:
|
||||
self.fullscreenmanager.endX()
|
||||
@ -1064,4 +1076,5 @@ class QUnFrameWindow(resizableframeless):
|
||||
saveallconfig()
|
||||
|
||||
endsubprocs()
|
||||
self.tryremoveuseless()
|
||||
os._exit(0)
|
||||
|
@ -72,13 +72,17 @@ def updatemethod(_version, progresscallback):
|
||||
stats = os.stat(savep)
|
||||
if stats.st_size == size:
|
||||
progresscallback(
|
||||
"总大小{} MB 进度 {}% ".format(
|
||||
"总大小{} MB 进度 {}% ,正在解压……".format(
|
||||
int(1000 * (int(size / 1024) / 1024)) / 1000,
|
||||
int(10000 * (size / size)) / 100,
|
||||
),
|
||||
10000,
|
||||
)
|
||||
endcallback()
|
||||
progresscallback(
|
||||
"准备完毕,等待更新",
|
||||
10000,
|
||||
)
|
||||
return True
|
||||
return False
|
||||
|
||||
|
@ -32,6 +32,15 @@ int updatewmain(int argc, wchar_t *argv[])
|
||||
{
|
||||
MessageBoxA(GetForegroundWindow(), (std::string("Update failed!\r\n") + e.what()).c_str(), "Error", 0);
|
||||
ShellExecute(0, L"open", L"https://github.com/HIllya51/LunaTranslator/releases", NULL, NULL, SW_SHOWNORMAL);
|
||||
return 0;
|
||||
}
|
||||
try
|
||||
{
|
||||
wcscat(path, L"\\cache\\update");
|
||||
std::filesystem::remove_all(path);
|
||||
}
|
||||
catch (std::exception &e)
|
||||
{
|
||||
}
|
||||
return 0;
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
#include "define.h"
|
||||
#include "define.h"
|
||||
|
||||
DECLARE void showintab(HWND hwnd, bool show)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user