Function un.checkAppRunning!insertmacro CHECK_APP_RUNNINGFunctionEndFunction un.onInitSetOutPath $INSTDIR${LogSet} on!insertmacro check64BitAndSetRegView${If} ${Silent}call un.checkAppRunning${else}!ifdef ONE_CLICKMessageBox MB_OKCANCEL "$(areYouSureToUninstall)" IDOK +2Quit# one-click installer executes uninstall section in the silent mode, but we must show message dialog if silent mode was not explicitly set by user (using /S flag)call un.checkAppRunningSetSilent silent!endif${endIf}!insertmacro initMultiUser!ifmacrodef customUnInit!insertmacro customUnInit!endifFunctionEndFunction un.atomicRMDirExch $R0Push $R1Push $R2Push $R3StrCpy $R3 "$INSTDIR$R0\*.*"FindFirst $R1 $R2 $R3loop:StrCmp $R2 "" breakStrCmp $R2 "." continueStrCmp $R2 ".." continueIfFileExists "$INSTDIR$R0\$R2\*.*" isDir isNotDirisDir:CreateDirectory "$PLUGINSDIR\old-install$R0\$R2"Push "$R0\$R2"Call un.atomicRMDirPop $R3${if} $R3 != 0Goto done${endIf}Goto continueisNotDir:ClearErrorsRename "$INSTDIR$R0\$R2" "$PLUGINSDIR\old-install$R0\$R2"# Ignore errors when renaming ourselves.StrCmp "$R0\$R2" "${UNINSTALL_FILENAME}" 0 +2ClearErrorsIfErrors 0 +3StrCpy $R3 "$INSTDIR$R0\$R2"Goto donecontinue:FindNext $R1 $R2Goto loopbreak:StrCpy $R3 0done:FindClose $R1StrCpy $R0 $R3Pop $R3Pop $R2Pop $R1Exch $R0FunctionEndFunction un.restoreFilesExch $R0Push $R1Push $R2Push $R3StrCpy $R3 "$PLUGINSDIR\old-install$R0\*.*"FindFirst $R1 $R2 $R3loop:StrCmp $R2 "" breakStrCmp $R2 "." continueStrCmp $R2 ".." continueIfFileExists "$INSTDIR$R0\$R2\*.*" isDir isNotDirisDir:CreateDirectory "$INSTDIR$R0\$R2"Push "$R0\$R2"Call un.restoreFilesPop $R3Goto continueisNotDir:Rename "$PLUGINSDIR\old-install$R0\$R2" "$INSTDIR$R0\$R2"continue:FindNext $R1 $R2Goto loopbreak:StrCpy $R0 0FindClose $R1Pop $R3Pop $R2Pop $R1Exch $R0FunctionEndSection "un.install"# for assisted installer we check it here to show progress!ifndef ONE_CLICK${IfNot} ${Silent}call un.checkAppRunning${endIf}!endif!insertmacro setLinkVars!ifmacrodef customUnInstall!insertmacro customUnInstall!endif# delete the installed files!ifmacrodef customRemoveFiles!insertmacro customRemoveFiles!else${if} ${isUpdated}CreateDirectory "$PLUGINSDIR\old-install"Push ""Call un.atomicRMDirPop $R0${if} $R0 != 0DetailPrint "File is busy, aborting: $R0"# Attempt to restore previous directoryPush ""Call un.restoreFilesPop $R0Abort `Can't rename "$INSTDIR" to "$PLUGINSDIR\old-install".`${endif}${endif}# Remove all files (or remaining shallow directories from the block above)RMDir /r $INSTDIR!endif${ifNot} ${isKeepShortcuts}WinShell::UninstAppUserModelId "${APP_ID}"!ifndef DO_NOT_CREATE_DESKTOP_SHORTCUTWinShell::UninstShortcut "$oldDesktopLink"Delete "$oldDesktopLink"!endif!ifndef DO_NOT_CREATE_START_MENU_SHORTCUTWinShell::UninstShortcut "$oldStartMenuLink"Delete "$oldStartMenuLink"ReadRegStr $R1 SHELL_CONTEXT "${INSTALL_REGISTRY_KEY}" MenuDirectory${ifNot} $R1 == ""RMDir "$SMPROGRAMS\$R1"${endIf}!endif${endIf}# refresh the desktopSystem::Call 'shell32::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)'!ifmacrodef unregisterFileAssociations!insertmacro unregisterFileAssociations!endifVar /GLOBAL isDeleteAppDataStrCpy $isDeleteAppData "0"ClearErrors${GetParameters} $R0${GetOptions} $R0 "--delete-app-data" $R1${if} ${Errors}!ifdef DELETE_APP_DATA_ON_UNINSTALL${ifNot} ${isUpdated}StrCpy $isDeleteAppData "1"${endif}!endif${else}StrCpy $isDeleteAppData "1"${endIf}${if} $isDeleteAppData == "1"# electron always uses per user app data${if} $installMode == "all"SetShellVarContext current${endif}RMDir /r "$APPDATA\${APP_FILENAME}"!ifdef APP_PRODUCT_FILENAMERMDir /r "$APPDATA\${APP_PRODUCT_FILENAME}"!endif# electron use package.json name for cache,indexdb etc.!ifdef APP_PACKAGE_NAMERMDir /r "$APPDATA\${APP_PACKAGE_NAME}"!endif${if} $installMode == "all"SetShellVarContext all${endif}${endif}DeleteRegKey SHELL_CONTEXT "${UNINSTALL_REGISTRY_KEY}"!ifdef UNINSTALL_REGISTRY_KEY_2DeleteRegKey SHELL_CONTEXT "${UNINSTALL_REGISTRY_KEY_2}"!endifDeleteRegKey SHELL_CONTEXT "${INSTALL_REGISTRY_KEY}"!ifdef ONE_CLICK!insertmacro quitSuccess!endifSectionEnd