👍[Update] installer : autoupdateの処理を変更

This commit is contained in:
misyaguziya
2023-10-30 20:29:18 +09:00
parent 676a64d0f5
commit a25fe345ed
3 changed files with 15 additions and 12 deletions

View File

@@ -1,11 +1,16 @@
@if not "%~0"=="%~dp0.\%~nx0" start /min cmd /c,"%~dp0.\%~nx0" %* & goto :eof @if not "%~0"=="%~dp0.\%~nx0" start /min cmd /c,"%~dp0.\%~nx0" %* & goto :eof
taskkill /im %1 /F set exe_name=%1
set folder_name=%2
set tmp_name=%3
set restart=%4
taskkill /im %exe_name% /F
ping -n 2 127.0.0.1 > nul ping -n 2 127.0.0.1 > nul
del /f %1 del /f %exe_name%
ping -n 2 127.0.0.1 > nul rmdir /s %folder_name%
rename %2 %1 move %tmp_name%\* .\
ping -n 2 127.0.0.1 > nul del /f %tmp_name%
if %3 == True ( if %restart% == True (
START "" %1 START "" %exe_name%
) )

View File

@@ -139,7 +139,7 @@ Section
; 出力先を指定します。 ; 出力先を指定します。
SetOutPath "$INSTDIR\docs" SetOutPath "$INSTDIR\docs"
; インストールされるファイル ; インストールされるファイル
File "..\dist\README.txt" File "..\README.txt"
${EndIf} ${EndIf}
; アンインストーラを出力 ; アンインストーラを出力

View File

@@ -268,7 +268,7 @@ class Model:
def updateSoftware(restart:bool=True): def updateSoftware(restart:bool=True):
filename = 'VRCT.zip' filename = 'VRCT.zip'
program_name = 'VRCT.exe' program_name = 'VRCT.exe'
temporary_name = '_VRCT.exe' folder_name = '_internal'
tmp_directory_name = 'tmp' tmp_directory_name = 'tmp'
batch_name = 'update.bat' batch_name = 'update.bat'
current_directory = os_path.dirname(sys.argv[0]) current_directory = os_path.dirname(sys.argv[0])
@@ -285,9 +285,7 @@ class Model:
file.write(chunk) file.write(chunk)
with ZipFile(os_path.join(current_directory, tmp_directory_name, filename)) as zf: with ZipFile(os_path.join(current_directory, tmp_directory_name, filename)) as zf:
zf.extract(program_name, os_path.join(current_directory, tmp_directory_name)) zf.extract(program_name, os_path.join(current_directory, tmp_directory_name))
os_rename(os_path.join(current_directory, tmp_directory_name, program_name), os_path.join(current_directory, temporary_name)) command = [os_path.join(program_directory, "batch", batch_name), program_name, folder_name, tmp_directory_name, str(restart)]
rmtree(os_path.join(current_directory, tmp_directory_name))
command = [os_path.join(program_directory, "batch", batch_name), program_name, temporary_name, str(restart)]
Popen(command) Popen(command)
except: except:
webbrowser.open(config.BOOTH_URL, new=2, autoraise=True) webbrowser.open(config.BOOTH_URL, new=2, autoraise=True)