Skip to content

Commit

Permalink
Fixed PortableApps.comInstallerCustom.nsh
Browse files Browse the repository at this point in the history
Fixed the code inside the PortableApps.comInstallerCustom.nsh file.
  • Loading branch information
daemondevin committed Sep 7, 2017
1 parent 71de532 commit 708d670
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 21 deletions.
Binary file modified 7-ZipPortable.exe
Binary file not shown.
59 changes: 38 additions & 21 deletions Other/Source/PortableApps.comInstallerCustom.nsh
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,55 @@
;= ################
Var Developer

;= DEFINES
;= ################
!define APP `7-Zip`
!define PORTABLE `${APP}Portable`

;= PRE INSTALL
;= ################
!macro CustomCodePreInstall
SetDetailsPrint textonly
DetailPrint "Checking for a different developer.."
DetailPrint "Checking if ${APP} Portable is already installed.."
SetDetailsPrint lastused
ReadINIStr $0 "$INSTDIR\App\AppInfo\appinfo.ini" Team Developer
${If} ${Errors}
${OrIfNot} "$0" == "demon.devin"
${If} "$0" == ""
StrCpy $Developer "Unknown Developer"
${Else}
StrCpy $Developer "$0"
${If} ${FileExists} "$INSTDIR\App\AppInfo\appinfo.ini"
SetDetailsPrint listonly
DetailPrint "${APP} Portable is already installed.."
DetailPrint "Checking if ${APP} was created by a different developer.."
ReadINIStr $0 "$INSTDIR\App\AppInfo\appinfo.ini" Team Developer
${IfNot} ${Errors}
${AndIfNot} "$0" == "demon.devin"
${If} "$0" == ""
StrCpy $Developer "Unknown Developer"
${Else}
StrCpy $Developer "$0"
${EndIf}
SetDetailsPrint textonly
DetailPrint "Different developer detected!"
SetDetailsPrint lastused
MESSAGEBOX MB_OKCANCEL|MB_ICONINFORMATION|MB_TOPMOST "Your current version of ${APP} Portable was created by another developer ($Developer).$\r$\n$\r$\nClick OK to overwrite everything and continue.$\r$\nClick Cancel to abort current installation.$\r$\n$\r$\nNOTE: If you select OK, everything will be overwritten (including any settings in ..\Data)." IDOK +3 IDCANCEL 0
Call .onInstFailed
Quit
SetDetailsPrint textonly
DetailPrint "Preparing current ${APP} Portable for new installation.."
SetDetailsPrint listonly
DetailPrint "Erasing previous settings and data.."
IfFileExists "$INSTDIR\${PORTABLE}.ini" 0 +2
Delete `$INSTDIR\${PORTABLE}.ini`
IfFileExists `$INSTDIR\Data\*.*` 0 +2
RMDir /r `$INSTDIR\Data`
${EndIf}
SetDetailsPrint textonly
DetailPrint "Different developer detected!"
SetDetailsPrint lastused
MESSAGEBOX MB_OKCANCEL|MB_ICONINFORMATION|MB_TOPMOST "Your current version was created by another developer ($Developer).$\r$\n$\r$\nClick OK to overwrite everything and continue.$\r$\nClick Cancel to abort current installation.$\r$\n$\r$\nNOTE: Everything will be overwritten (including any settings in ..\Data)." IDOK +3 IDCANCEL 0
Call .onInstFailed
Quit
SetDetailsPrint textonly
DetailPrint "Erasing old installation to prepare for new installation.."
${Else}
SetDetailsPrint listonly
DetailPrint "${APP} Portable is not installed.."
DetailPrint "Continuing with current installation.."
SetDetailsPrint lastused
IfFileExists "$INSTDIR\7-ZipPortable.ini" 0 +2
Delete `$INSTDIR\7-ZipPortable.ini`
RMDir /r `$INSTDIR\Data`
${EndIf}
!macroend

;= POST INSTALL
;= ################
!macro CustomCodePostInstall
IfFileExists "$INSTDIR\7-ZipPortable.ini" +2
CopyFiles /SILENT "$INSTDIR\Other\Source\7-ZipPortable.ini" "$INSTDIR"
IfFileExists "$INSTDIR\${PORTABLE}.ini" +2
CopyFiles /SILENT "$INSTDIR\Other\Source\${PORTABLE}.ini" "$INSTDIR"
!macroend

0 comments on commit 708d670

Please sign in to comment.