diff --git a/openless-all/app/package-lock.json b/openless-all/app/package-lock.json index 4f9b7c9f..9c599b80 100644 --- a/openless-all/app/package-lock.json +++ b/openless-all/app/package-lock.json @@ -1,12 +1,12 @@ { "name": "openless-app", - "version": "1.2.24-4", + "version": "1.2.24-5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "openless-app", - "version": "1.2.24-4", + "version": "1.2.24-5", "dependencies": { "@tauri-apps/api": "^2.1.1", "@tauri-apps/plugin-autostart": "^2.5.1", diff --git a/openless-all/app/package.json b/openless-all/app/package.json index 4f2e75f4..258d20fa 100644 --- a/openless-all/app/package.json +++ b/openless-all/app/package.json @@ -1,7 +1,7 @@ { "name": "openless-app", "private": true, - "version": "1.2.24-4", + "version": "1.2.24-5", "type": "module", "scripts": { "dev": "vite", diff --git a/openless-all/app/src-tauri/Cargo.lock b/openless-all/app/src-tauri/Cargo.lock index 8b9aaf09..e1283ab8 100644 --- a/openless-all/app/src-tauri/Cargo.lock +++ b/openless-all/app/src-tauri/Cargo.lock @@ -3751,7 +3751,7 @@ dependencies = [ [[package]] name = "openless" -version = "1.2.24-4" +version = "1.2.24-5" dependencies = [ "anyhow", "arboard", diff --git a/openless-all/app/src-tauri/Cargo.toml b/openless-all/app/src-tauri/Cargo.toml index ec2d958f..eead6568 100644 --- a/openless-all/app/src-tauri/Cargo.toml +++ b/openless-all/app/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "openless" -version = "1.2.24-4" +version = "1.2.24-5" description = "OpenLess — local voice input that types where your cursor is" authors = ["OpenLess"] edition = "2021" diff --git a/openless-all/app/src-tauri/nsis/openless-ime-hooks.nsh b/openless-all/app/src-tauri/nsis/openless-ime-hooks.nsh index 34e7ab1d..cdf6c9ff 100644 --- a/openless-all/app/src-tauri/nsis/openless-ime-hooks.nsh +++ b/openless-all/app/src-tauri/nsis/openless-ime-hooks.nsh @@ -56,12 +56,34 @@ !insertmacro OPENLESS_IME_ABORT_IF_FAILED $0 "x86 registration" !macroend -!macro NSIS_HOOK_PREINSTALL - SetOutPath "$INSTDIR\windows-ime\x64" - File /oname=OpenLessIme.dll "$%OPENLESS_IME_DLL_X64%" +!macro OPENLESS_IME_STAGE_AND_REPLACE PLATFORM_DIR ENV_VAR + ; Write new bytes to OpenLessIme.dll.new, then atomically replace the old file. + ; If the old DLL is still mapped into TSF client processes (browsers, IDEs, + ; chat apps, ...) and Delete fails, queue the rename for next reboot via + ; PendingFileRenameOperations. Issue #321. + SetOutPath "$INSTDIR\windows-ime\${PLATFORM_DIR}" + File /oname=OpenLessIme.dll.new "$%${ENV_VAR}%" + ClearErrors + Delete "$INSTDIR\windows-ime\${PLATFORM_DIR}\OpenLessIme.dll" + ${If} ${Errors} + DetailPrint "OpenLessIme.dll (${PLATFORM_DIR}) is in use; queuing replacement at next reboot" + Rename /REBOOTOK "$INSTDIR\windows-ime\${PLATFORM_DIR}\OpenLessIme.dll.new" "$INSTDIR\windows-ime\${PLATFORM_DIR}\OpenLessIme.dll" + SetRebootFlag true + ${Else} + Rename "$INSTDIR\windows-ime\${PLATFORM_DIR}\OpenLessIme.dll.new" "$INSTDIR\windows-ime\${PLATFORM_DIR}\OpenLessIme.dll" + ${EndIf} +!macroend - SetOutPath "$INSTDIR\windows-ime\x86" - File /oname=OpenLessIme.dll "$%OPENLESS_IME_DLL_X86%" +!macro NSIS_HOOK_PREINSTALL + ; Upgrade path: release the COM/TSF registration so new client processes won't + ; bind to the old DLL while we replace it. Fresh install: regsvr32 /u against + ; a missing DLL is harmless — the existing UNREGISTER macros log the exit code + ; and continue without aborting. + !insertmacro OPENLESS_IME_UNREGISTER_X86 + !insertmacro OPENLESS_IME_UNREGISTER_X64 + + !insertmacro OPENLESS_IME_STAGE_AND_REPLACE "x64" "OPENLESS_IME_DLL_X64" + !insertmacro OPENLESS_IME_STAGE_AND_REPLACE "x86" "OPENLESS_IME_DLL_X86" SetOutPath "$INSTDIR" !macroend diff --git a/openless-all/app/src-tauri/tauri.conf.json b/openless-all/app/src-tauri/tauri.conf.json index cf2fa44a..0c7c2300 100644 --- a/openless-all/app/src-tauri/tauri.conf.json +++ b/openless-all/app/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://schema.tauri.app/config/2", "productName": "OpenLess", - "version": "1.2.24-4", + "version": "1.2.24-5", "identifier": "com.openless.app", "build": { "beforeDevCommand": "npm run dev", diff --git a/openless-all/app/src-tauri/wix/openless-ime.wxs b/openless-all/app/src-tauri/wix/openless-ime.wxs index f7571a1b..39e419e2 100644 --- a/openless-all/app/src-tauri/wix/openless-ime.wxs +++ b/openless-all/app/src-tauri/wix/openless-ime.wxs @@ -45,8 +45,13 @@ Return="ignore" /> - - + + +