diff --git a/src-tauri/nsis-hooks.nsh b/src-tauri/nsis-hooks.nsh index f085d6b..a26c398 100644 --- a/src-tauri/nsis-hooks.nsh +++ b/src-tauri/nsis-hooks.nsh @@ -1,11 +1,50 @@ -!macro NSIS_HOOK_POSTINSTALL +!macro GITTY_MIGRATE_LEGACY_DATA_DIR oldDir newDir + ${IfNot} ${FileExists} "${newDir}\*.*" + ${AndIf} ${FileExists} "${oldDir}\*.*" + CreateDirectory "${newDir}" + Rename "${oldDir}" "${newDir}" + ${EndIf} +!macroend + +!macro GITTY_UNINSTALL_LEGACY_GITLITE rootKey + ClearErrors + ReadRegStr $R0 ${rootKey} "Software\Microsoft\Windows\CurrentVersion\Uninstall\GitLite" "UninstallString" + ${If} "$R0" != "" + ReadRegStr $R1 ${rootKey} "Software\git-lite\GitLite" "" + ${If} "$R1" == "" + ReadRegStr $R1 ${rootKey} "Software\Microsoft\Windows\CurrentVersion\Uninstall\GitLite" "InstallLocation" + ${EndIf} + + DetailPrint "Removing legacy GitLite installation" + ${If} "$R1" != "" + ExecWait '$R0 /S _?=$R1' $R2 + ${Else} + ExecWait '$R0 /S' $R2 + ${EndIf} + ${EndIf} + + DeleteRegKey ${rootKey} "Software\Microsoft\Windows\CurrentVersion\Uninstall\GitLite" + DeleteRegKey ${rootKey} "Software\git-lite\GitLite" + DeleteRegKey /ifempty ${rootKey} "Software\git-lite" +!macroend + +!macro GITTY_CLEANUP_LEGACY_SHORTCUTS Delete "$DESKTOP\GitLite.lnk" Delete "$SMPROGRAMS\GitLite.lnk" RMDir /r "$SMPROGRAMS\GitLite" !macroend +!macro NSIS_HOOK_PREINSTALL + !insertmacro GITTY_MIGRATE_LEGACY_DATA_DIR "$APPDATA\com.git-lite" "$APPDATA\com.gitty" + !insertmacro GITTY_MIGRATE_LEGACY_DATA_DIR "$LOCALAPPDATA\com.git-lite" "$LOCALAPPDATA\com.gitty" + !insertmacro GITTY_UNINSTALL_LEGACY_GITLITE HKCU + !insertmacro GITTY_UNINSTALL_LEGACY_GITLITE HKLM +!macroend + +!macro NSIS_HOOK_POSTINSTALL + !insertmacro GITTY_CLEANUP_LEGACY_SHORTCUTS +!macroend + !macro NSIS_HOOK_POSTUNINSTALL - Delete "$DESKTOP\GitLite.lnk" - Delete "$SMPROGRAMS\GitLite.lnk" - RMDir /r "$SMPROGRAMS\GitLite" + !insertmacro GITTY_CLEANUP_LEGACY_SHORTCUTS !macroend diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 0e4f340..d347ef6 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -2,7 +2,7 @@ "$schema": "https://schema.tauri.app/config/2", "productName": "Gitty", "version": "2026.7.16", - "identifier": "com.git-lite", + "identifier": "com.gitty", "build": { "beforeDevCommand": "npm run dev", "devUrl": "http://127.0.0.1:1420",