diff --git a/batch/update.bat b/batch/update.bat index 2a7fc7b2..a492fbc4 100644 --- a/batch/update.bat +++ b/batch/update.bat @@ -1,11 +1,16 @@ @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 -del /f %1 -ping -n 2 127.0.0.1 > nul -rename %2 %1 -ping -n 2 127.0.0.1 > nul -if %3 == True ( - START "" %1 +del /f %exe_name% +rmdir /s %folder_name% +move %tmp_name%\* .\ +del /f %tmp_name% +if %restart% == True ( + START "" %exe_name% ) \ No newline at end of file diff --git a/installer/Install.nsi b/installer/Install.nsi index 5ee5b8bc..45235ed8 100644 --- a/installer/Install.nsi +++ b/installer/Install.nsi @@ -139,7 +139,7 @@ Section ; 出力先を指定します。 SetOutPath "$INSTDIR\docs" ; インストールされるファイル - File "..\dist\README.txt" + File "..\README.txt" ${EndIf} ; アンインストーラを出力 diff --git a/model.py b/model.py index af1d3777..ecf57fc3 100644 --- a/model.py +++ b/model.py @@ -268,7 +268,7 @@ class Model: def updateSoftware(restart:bool=True): filename = 'VRCT.zip' program_name = 'VRCT.exe' - temporary_name = '_VRCT.exe' + folder_name = '_internal' tmp_directory_name = 'tmp' batch_name = 'update.bat' current_directory = os_path.dirname(sys.argv[0]) @@ -285,9 +285,7 @@ class Model: file.write(chunk) 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)) - os_rename(os_path.join(current_directory, tmp_directory_name, program_name), os_path.join(current_directory, temporary_name)) - rmtree(os_path.join(current_directory, tmp_directory_name)) - command = [os_path.join(program_directory, "batch", batch_name), program_name, temporary_name, str(restart)] + command = [os_path.join(program_directory, "batch", batch_name), program_name, folder_name, tmp_directory_name, str(restart)] Popen(command) except: webbrowser.open(config.BOOTH_URL, new=2, autoraise=True)