- Add update notification dialog on startup - Implement portable ZIP update mechanism with robocopy - Auto-restart after update - Remove update banner, show dialog directly - Fix Windows Server compatibility
This commit is contained in:
@@ -213,13 +213,14 @@ class NewVersionDialog extends HookConsumerWidget with PresLogger {
|
||||
final updateScript = '''
|
||||
@echo off
|
||||
echo Waiting for application to close...
|
||||
timeout /t 3 /nobreak > nul
|
||||
timeout /t 2 /nobreak > nul
|
||||
|
||||
echo Updating files...
|
||||
xcopy /E /Y "${tempDir.path}\\*" "$appDir\\"
|
||||
robocopy "${tempDir.path}" "$appDir" /E /IS /IT /COPY:DAT /DCOPY:DAT /R:3 /W:1
|
||||
|
||||
echo Cleanup...
|
||||
rmdir /S /Q "${tempDir.path}"
|
||||
del "$savePath"
|
||||
|
||||
echo Starting application...
|
||||
start "" "$exePath"
|
||||
@@ -233,16 +234,16 @@ del "%~f0"
|
||||
|
||||
if (context.mounted) {
|
||||
CustomToast.success('Обновление установлено! Приложение перезагрузится...').show(context);
|
||||
await Future.delayed(const Duration(milliseconds: 500));
|
||||
context.pop();
|
||||
}
|
||||
|
||||
// Запустить скрипт и закрыть приложение
|
||||
await Process.start('cmd', ['/c', scriptPath], mode: ProcessStartMode.detached);
|
||||
// Запустить скрипт в фоне
|
||||
Process.start('cmd', ['/c', 'start', '/min', scriptPath], mode: ProcessStartMode.detached);
|
||||
|
||||
// Задержка перед выходом
|
||||
Future.delayed(const Duration(seconds: 1), () {
|
||||
exit(0);
|
||||
});
|
||||
// Немедленный выход из приложения
|
||||
await Future.delayed(const Duration(milliseconds: 200));
|
||||
exit(0);
|
||||
|
||||
return;
|
||||
} catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user