PortableApps.com Installer 0.10.4 (2008-09-09)

John T. Haller's picture
Submitted by John T. Haller on August 5, 2008 - 2:27pm

The PortableApps.com Installer has had a major update. The configuration is now separate from the code and includes options to set what directories and files to keep and delete, so no coding is necessary on the part of a developer in the case of most installation needs.

Version 0.10 debuted with WinSCP 4.1.6 on August 5, 2008. Version 0.10.1 corrects a file naming error having to do with custom code which is not used by WinSCP's installer. Version 0.10.2 corrects an issue with Plugin mode requiring there to be files in the root directory. Version 0.10.3 allows plugin installers to now be named PortableApps.comInstallerPlugin.nsi and the associated config file to PortableApps.comInstallerPluginCustom.nsh to avoid overwriting the main app installer. 0.10.4 fixed a bug with blank suffixed not being accepted.

Here is the PortableApps.comInstaller.nsi which should not be editted:

;Copyright 2007-2008 John T. Haller of PortableApps.com

;Website: http://PortableApps.com/

;This software is OSI Certified Open Source Software.
;OSI Certified is a certification mark of the Open Source Initiative.

;This program is free software; you can redistribute it and/or
;modify it under the terms of the GNU General Public License
;as published by the Free Software Foundation; either version 2
;of the License, or (at your option) any later version.

;This program is distributed in the hope that it will be useful,
;but WITHOUT ANY WARRANTY; without even the implied warranty of
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;GNU General Public License for more details.

;You should have received a copy of the GNU General Public License
;along with this program; if not, write to the Free Software
;Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

;EXCEPTION: Can be used with non-GPL apps distributed by PortableApps.com

!define PORTABLEAPPSINSTALLERVERSION "0.10.4.0"

!if ${__FILE__} == "PortableApps.comInstallerPlugin.nsi"
	!include PortableApps.comInstallerPluginConfig.nsh
!else
	!include PortableApps.comInstallerConfig.nsh
!endif

!define MAINSECTIONIDX 0
!ifdef MAINSECTIONTITLE
	!define OPTIONALSECTIONIDX 1
!endif

;=== Program Details
Name "${NAME}"
OutFile "..\..\..\${FILENAME}.paf.exe"
InstallDir "\${SHORTNAME}"
Caption "${NAME} | PortableApps.com Installer"
VIProductVersion "${VERSION}"
VIAddVersionKey ProductName "${NAME}"
VIAddVersionKey Comments "${INSTALLERCOMMENTS}"
VIAddVersionKey CompanyName "PortableApps.com"
VIAddVersionKey LegalCopyright "PortableApps.com Installer Copyright 2007-2008 PortableApps.com."
VIAddVersionKey FileDescription "${NAME}"
VIAddVersionKey FileVersion "${VERSION}"
VIAddVersionKey ProductVersion "${VERSION}"
VIAddVersionKey InternalName "${NAME}"
VIAddVersionKey LegalTrademarks "${INSTALLERADDITIONALTRADEMARKS}PortableApps.com is a Trademark of Rare Ideas, LLC."
VIAddVersionKey OriginalFilename "${FILENAME}.paf.exe"
VIAddVersionKey PortableApps.comInstallerVersion "${PORTABLEAPPSINSTALLERVERSION}"
;VIAddVersionKey PrivateBuild ""
;VIAddVersionKey SpecialBuild ""

;=== Runtime Switches
SetCompress Auto
SetCompressor /SOLID lzma
SetCompressorDictSize 32
SetDatablockOptimize On
CRCCheck on
AutoCloseWindow True
RequestExecutionLevel user

;=== Include
!include MUI.nsh
!include FileFunc.nsh
!include LogicLib.nsh
!insertmacro DriveSpace
!insertmacro GetOptions
!insertmacro GetDrives
!insertmacro GetRoot
!insertmacro GetSize
!insertmacro GetParent
!include TextFunc.nsh

!ifdef USESCONFIGREAD
	!insertmacro ConfigRead
!endif
!ifdef USESCONFIGREADS
	!insertmacro ConfigReadS
!endif
!ifdef USESCONFIGWRITE
	!insertmacro ConfigWrite
!endif
!ifdef USESCONFIGWRITES
	!insertmacro ConfigWriteS
!endif

;=== Program Icon
!ifdef PLUGININSTALLER
	Icon "PortableApps.comInstallerPlugin.ico"
	!define MUI_ICON "PortableApps.comInstallerPlugin.ico"
!else
	Icon "..\..\App\AppInfo\appicon.ico"
	!define MUI_ICON "..\..\App\AppInfo\appicon.ico"
!endif

;=== Icon & Stye ===
BrandingText "PortableApps.com - Your Digital Life, Anywhere™"

;=== Pages
!define MUI_WELCOMEFINISHPAGE_BITMAP "PortableApps.comInstaller.bmp"
!define MUI_WELCOMEPAGE_TITLE "${NAME}"
!define MUI_WELCOMEPAGE_TEXT "$(welcome)"
!define MUI_COMPONENTSPAGE_SMALLDESC
!insertmacro MUI_PAGE_WELCOME
!ifdef LICENSEAGREEMENT
	!define MUI_LICENSEPAGE_CHECKBOX
	!insertmacro MUI_PAGE_LICENSE "${LICENSEAGREEMENT}"
!endif
!ifdef MAINSECTIONTITLE
	!insertmacro MUI_PAGE_COMPONENTS
!endif
!define MUI_DIRECTORYPAGE_VERIFYONLEAVE
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE LeaveDirectory
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!define MUI_FINISHPAGE_TEXT "$(finish)"
!insertmacro MUI_PAGE_FINISH

;=== Languages
!insertmacro MUI_LANGUAGE "${INSTALLERLANGUAGE}"
!include PortableApps.comInstallerLANG_${INSTALLERLANGUAGE}.nsh

;=== Variables
Var FOUNDPORTABLEAPPSPATH
!ifdef MAINSECTIONTITLE
	Var OPTIONAL1DONE
!endif

;=== Custom Code
!ifdef USESCUSTOMCODE
	!if ${__FILE__} == "PortableApps.comInstallerPlugin.nsi"
		!include PortableApps.comInstallerPluginCustom.nsh
	!else
		!include PortableApps.comInstallerCustom.nsh
	!endif
!endif

Function .onInit
	${GetOptions} "$CMDLINE" "/DESTINATION=" $R0

	IfErrors CheckLegacyDestination
		StrCpy $INSTDIR "$R0${SHORTNAME}"
		Goto InitDone

	CheckLegacyDestination:
		ClearErrors
		${GetOptions} "$CMDLINE" "-o" $R0
		IfErrors NoDestination
			StrCpy $INSTDIR "$R0${SHORTNAME}"
			Goto InitDone

	NoDestination:
		ClearErrors
		${GetDrives} "HDD+FDD" GetDrivesCallBack
		StrCmp $FOUNDPORTABLEAPPSPATH "" DefaultDestination
			StrCpy $INSTDIR "$FOUNDPORTABLEAPPSPATH\${SHORTNAME}"
			Goto InitDone
		
	DefaultDestination:
		StrCpy $INSTDIR "\${SHORTNAME}"

	InitDone:
FunctionEnd

Function LeaveDirectory
	GetInstDirError $0
  
	;=== Does it already exist? (upgrade)
	IfFileExists "$INSTDIR" "" CheckInstallerError
		;=== Check if app is running?
		StrCmp ${CHECKRUNNING} "NONE" CheckInstallerError
			FindProcDLL::FindProc "${CHECKRUNNING}"
			StrCmp $R0 "1" "" CheckInstallerError
				MessageBox MB_OK|MB_ICONINFORMATION `$(runwarning)`
				Abort
  
	CheckInstallerError:
		${Switch} $0
		    ${Case} 0 ;=== Valid directory and enough free space
				${Break}
		    ${Case} 1
				MessageBox MB_OK `$(invaliddirectory)`
				Abort
				${Break}
		    ${Case} 2
				IfFileExists `$INSTDIR` "" NotEnoughSpaceNoUpgrade ;=== Is upgrade
					SectionGetSize ${MAINSECTIONIDX} $1 ;=== Space Required for App
					!ifdef MAINSECTIONTITLE
							SectionGetFlags ${OPTIONALSECTIONIDX} $9
							IntOp $9 $9 & ${SF_SELECTED}
							IntCmp $9 ${SF_SELECTED} "" NoOptions
								SectionGetSize ${OPTIONALSECTIONIDX} $2 ;=== Space Required for App
							IntOp $1 $1 + $2
						NoOptions:
					!endif
					${GetRoot} `$INSTDIR` $2
					${DriveSpace} `$2\` "/D=F /S=K" $3 ;=== Space Free on Device

					!ifndef PLUGININSTALLER ;=== If not a plugin installer, add the current install size to free space
						${GetSize} `$INSTDIR` "/M=*.* /S=0K /G=1" $4 $5 $6 ;=== Current installation size
						IntOp $3 $3 + $4 ;=== Space Free + Current Install Size
					!else
						Goto CalculateSpaceLeft
					!endif

					IfFileExists `$INSTDIR\Data` "" CheckPluginsDirectory
						${GetSize} `$INSTDIR\Data` "/M=*.* /S=0K /G=1" $4 $5 $6 ;=== Size of Data directory
						IntOp $3 $3 - $4 ;=== Remove the data directory from the free space calculation

				CheckPluginsDirectory:
					StrCmp `${ADDONSDIRECTORYPRESERVE}` "NONE" CalculateSpaceLeft
						IfFileExists `$INSTDIR\${ADDONSDIRECTORYPRESERVE}` "" CalculateSpaceLeft
							${GetSize} `$INSTDIR\${ADDONSDIRECTORYPRESERVE}` "/M=*.* /S=0K /G=1" $4 $5 $6 ;=== Size of Data directory
							IntOp $3 $3 - $4 ;=== Remove the plugins directory from the free space calculation

				CalculateSpaceLeft:
					IntCmp $3 $1 NotEnoughSpaceNoUpgrade NotEnoughSpaceNoUpgrade
					Goto EndNotEnoughSpace

				NotEnoughSpaceNoUpgrade:
					MessageBox MB_OK `$(notenoughspace)`
					Abort

				EndNotEnoughSpace:
				${Break}
		${EndSwitch}
FunctionEnd

Function GetDrivesCallBack
	;=== Skip usual floppy letters
	StrCmp $8 "FDD" "" CheckForPortableAppsPath
	StrCmp $9 "A:\" End
	StrCmp $9 "B:\" End
	
	CheckForPortableAppsPath:
		IfFileExists "$9PortableApps" "" End
			StrCpy $FOUNDPORTABLEAPPSPATH "$9PortableApps"

	End:
		Push $0
FunctionEnd

!ifdef MAINSECTIONTITLE
	Section "${MAINSECTIONTITLE}"
!else
	Section "App Portable (required)"
!endif
	SectionIn RO
	SetOutPath $INSTDIR
	
!ifdef MAINSECTIONTITLE
	SectionGetFlags 1 $0
	IntOp $0 $0 & ${SF_SELECTED}
	IntCmp $0 ${SF_SELECTED} MainSkipOptionalCleanup
		;=== BEGIN: OPTIONAL NOT SELECTED CLEANUP CODE ===
		;This will be executed before install if the optional section (additional languages, etc) is not selected
		!ifmacrodef CustomCodeOptionalCleanup
			!insertmacro CustomCodeOptionalCleanup
		!endif
		;=== END: OPTIONAL NOT SELECTED CLEANUP CODE ===
	MainSkipOptionalCleanup:
!endif
	
	;=== Rename the preserved files so they're not deleted in the next part
	!ifdef PRESERVEFILE1
		Rename `$INSTDIR\${PRESERVEFILE1}` `$INSTDIR\~PRESERVEFILE1`
	!endif
	!ifdef PRESERVEFILE2
		Rename `$INSTDIR\${PRESERVEFILE2}` `$INSTDIR\~PRESERVEFILE2`
	!endif
	!ifdef PRESERVEFILE3
		Rename `$INSTDIR\${PRESERVEFILE3}` `$INSTDIR\~PRESERVEFILE3`
	!endif
	!ifdef PRESERVEFILE4
		Rename `$INSTDIR\${PRESERVEFILE4}` `$INSTDIR\~PRESERVEFILE4`
	!endif
	!ifdef PRESERVEFILE5
		Rename `$INSTDIR\${PRESERVEFILE5}` `$INSTDIR\~PRESERVEFILE5`
	!endif
	!ifdef PRESERVEFILE6
		Rename `$INSTDIR\${PRESERVEFILE6}` `$INSTDIR\~PRESERVEFILE6`
	!endif
	!ifdef PRESERVEFILE7
		Rename `$INSTDIR\${PRESERVEFILE7}` `$INSTDIR\~PRESERVEFILE7`
	!endif
	!ifdef PRESERVEFILE8
		Rename `$INSTDIR\${PRESERVEFILE8}` `$INSTDIR\~PRESERVEFILE8`
	!endif
	!ifdef PRESERVEFILE9
		Rename `$INSTDIR\${PRESERVEFILE9}` `$INSTDIR\~PRESERVEFILE9`
	!endif
	!ifdef PRESERVEFILE10
		Rename `$INSTDIR\${PRESERVEFILE10}` `$INSTDIR\~PRESERVEFILE10`
	!endif
	
	;=== Rename the preserved directories so they're not deleted in the next part
	!ifdef PRESERVEDIRECTORY1
		Rename `$INSTDIR\${PRESERVEDIRECTORY1}\` `$INSTDIR\~PRESERVEDIRECTORY1\`
	!endif
	!ifdef PRESERVEDIRECTORY2
		Rename `$INSTDIR\${PRESERVEDIRECTORY2}\` `$INSTDIR\~PRESERVEDIRECTORY2\`
	!endif
	!ifdef PRESERVEDIRECTORY3
		Rename `$INSTDIR\${PRESERVEDIRECTORY3}\` `$INSTDIR\~PRESERVEDIRECTORY3\`
	!endif
	!ifdef PRESERVEDIRECTORY4
		Rename `$INSTDIR\${PRESERVEDIRECTORY4}\` `$INSTDIR\~PRESERVEDIRECTORY4\`
	!endif
	!ifdef PRESERVEDIRECTORY5
		Rename `$INSTDIR\${PRESERVEDIRECTORY5}\` `$INSTDIR\~PRESERVEDIRECTORY5\`
	!endif
	!ifdef PRESERVEDIRECTORY6
		Rename `$INSTDIR\${PRESERVEDIRECTORY6}\` `$INSTDIR\~PRESERVEDIRECTORY6\`
	!endif
	!ifdef PRESERVEDIRECTORY7
		Rename `$INSTDIR\${PRESERVEDIRECTORY7}\` `$INSTDIR\~PRESERVEDIRECTORY7\`
	!endif
	!ifdef PRESERVEDIRECTORY8
		Rename `$INSTDIR\${PRESERVEDIRECTORY8}\` `$INSTDIR\~PRESERVEDIRECTORY8\`
	!endif
	!ifdef PRESERVEDIRECTORY9
		Rename `$INSTDIR\${PRESERVEDIRECTORY9}\` `$INSTDIR\~PRESERVEDIRECTORY9\`
	!endif
	!ifdef PRESERVEDIRECTORY10
		Rename `$INSTDIR\${PRESERVEDIRECTORY10}\` `$INSTDIR\~PRESERVEDIRECTORY10\`
	!endif
	
	;=== Remove main directories if necessary
	!ifdef REMOVEAPPDIRECTORY
		RMDir /r `$INSTDIR\App`
	!endif
	!ifdef REMOVEDATADIRECTORY
		RMDir /r `$INSTDIR\Data`
	!endif
	!ifdef REMOVEOTHERDIRECTORY
		RMDir /r `$INSTDIR\Other`
	!endif
	
	;=== Remove specific directories
	!ifdef REMOVEDIRECTORY1
		RMDir /r `$INSTDIR\${REMOVEDIRECTORY1}`
	!endif
	!ifdef REMOVEDIRECTORY2
		RMDir /r `$INSTDIR\${REMOVEDIRECTORY2}`
	!endif
	!ifdef REMOVEDIRECTORY3
		RMDir /r `$INSTDIR\${REMOVEDIRECTORY3}`
	!endif
	!ifdef REMOVEDIRECTORY4
		RMDir /r `$INSTDIR\${REMOVEDIRECTORY4}`
	!endif
	!ifdef REMOVEDIRECTORY5
		RMDir /r `$INSTDIR\${REMOVEDIRECTORY5}`
	!endif
	!ifdef REMOVEDIRECTORY6
		RMDir /r `$INSTDIR\${REMOVEDIRECTORY6}`
	!endif
	!ifdef REMOVEDIRECTORY7
		RMDir /r `$INSTDIR\${REMOVEDIRECTORY7}`
	!endif
	!ifdef REMOVEDIRECTORY8
		RMDir /r `$INSTDIR\${REMOVEDIRECTORY8}`
	!endif
	!ifdef REMOVEDIRECTORY9
		RMDir /r `$INSTDIR\${REMOVEDIRECTORY9}`
	!endif
	!ifdef REMOVEDIRECTORY10
		RMDir /r `$INSTDIR\${REMOVEDIRECTORY10}`
	!endif
	
	;=== Remove specific files
	!ifdef REMOVEFILE1
		Delete `$INSTDIR\${REMOVEFILE1}` 
	!endif
	!ifdef REMOVEFILE2
		Delete `$INSTDIR\${REMOVEFILE2}` 
	!endif
	!ifdef REMOVEFILE3
		Delete `$INSTDIR\${REMOVEFILE3}` 
	!endif
	!ifdef REMOVEFILE4
		Delete `$INSTDIR\${REMOVEFILE4}` 
	!endif
	!ifdef REMOVEFILE5
		Delete `$INSTDIR\${REMOVEFILE5}` 
	!endif
	!ifdef REMOVEFILE6
		Delete `$INSTDIR\${REMOVEFILE6}` 
	!endif
	!ifdef REMOVEFILE7
		Delete `$INSTDIR\${REMOVEFILE7}` 
	!endif
	!ifdef REMOVEFILE8
		Delete `$INSTDIR\${REMOVEFILE8}` 
	!endif
	!ifdef REMOVEFILE9
		Delete `$INSTDIR\${REMOVEFILE9}` 
	!endif
	!ifdef REMOVEFILE10
		Delete `$INSTDIR\${REMOVEFILE10}` 
	!endif
	
	;=== Rename the preserved directories back to their proper names
	!ifdef PRESERVEDIRECTORY1
		${GetParent} `$INSTDIR\${PRESERVEDIRECTORY1}\` $R0
		CreateDirectory $R0
		Rename `$INSTDIR\~PRESERVEDIRECTORY1\` `$INSTDIR\${PRESERVEDIRECTORY1}\`
	!endif
	!ifdef PRESERVEDIRECTORY2
		${GetParent} `$INSTDIR\${PRESERVEDIRECTORY2}\` $R0
		CreateDirectory $R0
		Rename `$INSTDIR\~PRESERVEDIRECTORY2\` `$INSTDIR\${PRESERVEDIRECTORY2}\`
	!endif
	!ifdef PRESERVEDIRECTORY3
		${GetParent} `$INSTDIR\${PRESERVEDIRECTORY3}\` $R0
		CreateDirectory $R0
		Rename `$INSTDIR\~PRESERVEDIRECTORY3\` `$INSTDIR\${PRESERVEDIRECTORY3}\`
	!endif
	!ifdef PRESERVEDIRECTORY4
		${GetParent} `$INSTDIR\${PRESERVEDIRECTORY4}\` $R0
		CreateDirectory $R0
		Rename `$INSTDIR\~PRESERVEDIRECTORY4\` `$INSTDIR\${PRESERVEDIRECTORY4}\`
	!endif
	!ifdef PRESERVEDIRECTORY5
		${GetParent} `$INSTDIR\${PRESERVEDIRECTORY5}\` $R0
		CreateDirectory $R0
		Rename `$INSTDIR\~PRESERVEDIRECTORY5\` `$INSTDIR\${PRESERVEDIRECTORY5}\`
	!endif
	!ifdef PRESERVEDIRECTORY6
		${GetParent} `$INSTDIR\${PRESERVEDIRECTORY6}\` $R0
		CreateDirectory $R0
		Rename `$INSTDIR\~PRESERVEDIRECTORY6\` `$INSTDIR\${PRESERVEDIRECTORY6}\`
	!endif
	!ifdef PRESERVEDIRECTORY7
		${GetParent} `$INSTDIR\${PRESERVEDIRECTORY7}\` $R0
		CreateDirectory $R0
		Rename `$INSTDIR\~PRESERVEDIRECTORY7\` `$INSTDIR\${PRESERVEDIRECTORY7}\`
	!endif
	!ifdef PRESERVEDIRECTORY8
		${GetParent} `$INSTDIR\${PRESERVEDIRECTORY8}\` $R0
		CreateDirectory $R0
		Rename `$INSTDIR\~PRESERVEDIRECTORY8\` `$INSTDIR\${PRESERVEDIRECTORY8}\`
	!endif
	!ifdef PRESERVEDIRECTORY9
		${GetParent} `$INSTDIR\${PRESERVEDIRECTORY9}\` $R0
		CreateDirectory $R0
		Rename `$INSTDIR\~PRESERVEDIRECTORY9\` `$INSTDIR\${PRESERVEDIRECTORY9}\`
	!endif
	!ifdef PRESERVEDIRECTORY10
		${GetParent} `$INSTDIR\${PRESERVEDIRECTORY10}\` $R0
		CreateDirectory $R0
		Rename `$INSTDIR\~PRESERVEDIRECTORY10\` `$INSTDIR\${PRESERVEDIRECTORY10}\`
	!endif
	
	;=== Rename the preserved files back to their proper names
	!ifdef PRESERVEFILE1
		${GetParent} `$INSTDIR\${PRESERVEFILE1}` $R0
		CreateDirectory $R0
		Rename `$INSTDIR\~PRESERVEFILE1` `$INSTDIR\${PRESERVEFILE1}`
	!endif
	!ifdef PRESERVEFILE2
		${GetParent} `$INSTDIR\${PRESERVEFILE2}` $R0
		CreateDirectory $R0
		Rename `$INSTDIR\~PRESERVEFILE2` `$INSTDIR\${PRESERVEFILE2}`
	!endif
	!ifdef PRESERVEFILE3
		${GetParent} `$INSTDIR\${PRESERVEFILE3}` $R0
		CreateDirectory $R0
		Rename `$INSTDIR\~PRESERVEFILE3` `$INSTDIR\${PRESERVEFILE3}`
	!endif
	!ifdef PRESERVEFILE4
		${GetParent} `$INSTDIR\${PRESERVEFILE4}` $R0
		CreateDirectory $R0
		Rename `$INSTDIR\~PRESERVEFILE4` `$INSTDIR\${PRESERVEFILE4}`
	!endif
	!ifdef PRESERVEFILE5
		${GetParent} `$INSTDIR\${PRESERVEFILE5}` $R0
		CreateDirectory $R0
		Rename `$INSTDIR\~PRESERVEFILE5` `$INSTDIR\${PRESERVEFILE5}`
	!endif
	!ifdef PRESERVEFILE6
		${GetParent} `$INSTDIR\${PRESERVEFILE6}` $R0
		CreateDirectory $R0
		Rename `$INSTDIR\~PRESERVEFILE6` `$INSTDIR\${PRESERVEFILE6}`
	!endif
	!ifdef PRESERVEFILE7
		${GetParent} `$INSTDIR\${PRESERVEFILE7}` $R0
		CreateDirectory $R0
		Rename `$INSTDIR\~PRESERVEFILE7` `$INSTDIR\${PRESERVEFILE7}`
	!endif
	!ifdef PRESERVEFILE8
		${GetParent} `$INSTDIR\${PRESERVEFILE8}` $R0
		CreateDirectory $R0
		Rename `$INSTDIR\~PRESERVEFILE8` `$INSTDIR\${PRESERVEFILE8}`
	!endif
	!ifdef PRESERVEFILE9
		${GetParent} `$INSTDIR\${PRESERVEFILE9}` $R0
		CreateDirectory $R0
		Rename `$INSTDIR\~PRESERVEFILE9` `$INSTDIR\${PRESERVEFILE9}`
	!endif
	!ifdef PRESERVEFILE10
		${GetParent} `$INSTDIR\${PRESERVEFILE10}` $R0
		CreateDirectory $R0
		Rename `$INSTDIR\~PRESERVEFILE10` `$INSTDIR\${PRESERVEFILE10}`
	!endif
	
	;=== BEGIN: PRE-INSTALL CODE ===
	;This will be executed before the app is installed.  Useful for cleaning up files no longer used.
	!ifmacrodef CustomCodePreInstall
		!insertmacro CustomCodePreInstall
	!endif
	;=== END: PRE-INSTALL CODE ===
	
	!ifndef PLUGININSTALLER
		File "..\..\*.*"
	!endif
	SetOutPath $INSTDIR\App
	File /r "..\..\App\*.*"
	SetOutPath $INSTDIR\Other
	File /r "..\..\Other\*.*"
	CreateDirectory "$INSTDIR\Data"
	
	;=== BEGIN: POST-INSTALL CODE ===
	;This will be executed after the app is installed.  Useful for updating configuration files.
	!ifmacrodef CustomCodePostInstall
		!insertmacro CustomCodePostInstall
	!endif	
	;=== END: POST-INSTALL CODE ===
	
	;=== Refresh PortableApps.com Menu (not final version)
	${GetParent} `$INSTDIR` $0
	;=== Check that it exists at the right location
	DetailPrint '$(checkforplatform)'
	IfFileExists `$0\PortableApps.com\App\PortableAppsPlatform.exe` "" TheEnd
		;=== Check that it's the real deal so we aren't hanging with no response
		MoreInfo::GetProductName `$0\PortableApps.com\App\PortableAppsPlatform.exe`
		Pop $1
		StrCmp $1 "PortableApps.com Platform" "" TheEnd
		MoreInfo::GetCompanyName `$0\PortableApps.com\App\PortableAppsPlatform.exe`
		Pop $1
		StrCmp $1 "PortableApps.com" "" TheEnd
		
		;=== Check that it's running
		FindProcDLL::FindProc "PortableAppsPlatform.exe"
		StrCmp $R0 "1" "" TheEnd
		
		;=== Send message for the Menu to refresh
		StrCpy $2 'PortableApps.comPlatformWindowMessageToRefresh$0\PortableApps.com\App\PortableAppsPlatform.exe'
		System::Call "user32::RegisterWindowMessage(t r2) i .r3"
		DetailPrint '$(refreshmenu)'
		SendMessage 65535 $3 0 0
	TheEnd:
SectionEnd

!ifdef MAINSECTIONTITLE
	Section /o "${OPTIONALSECTIONTITLE}"
		SetOutPath $INSTDIR
		File /r "..\..\..\${SHORTNAME}Optional1\*.*"
		StrCpy $OPTIONAL1DONE "true"
	SectionEnd

	Section "-UpdateAppInfo" SecUpdateAppInfo
		StrCmp $OPTIONAL1DONE "true" SecUpdateAppInfoOptionalSelected
			StrCmp "${OPTIONALSECTIONNOTSELECTEDAPPINFOSUFFIX}" "" SecUpdateAppInfoTheEnd
				ReadINIStr $0 "$INSTDIR\App\AppInfo\appinfo.ini" "Version" "DisplayVersion"
				WriteINIStr "$INSTDIR\App\AppInfo\appinfo.ini" "Version" "DisplayVersion" "$0 ${OPTIONALSECTIONNOTSELECTEDAPPINFOSUFFIX}"
			Goto SecUpdateAppInfoTheEnd

		SecUpdateAppInfoOptionalSelected:
			StrCmp "${OPTIONALSECTIONSELECTEDAPPINFOSUFFIX}" "" SecUpdateAppInfoTheEnd
				ReadINIStr $0 "$INSTDIR\App\AppInfo\appinfo.ini" "Version" "DisplayVersion"
				WriteINIStr "$INSTDIR\App\AppInfo\appinfo.ini" "Version" "DisplayVersion" "$0 ${OPTIONALSECTIONSELECTEDAPPINFOSUFFIX}"
		SecUpdateAppInfoTheEnd:
	SectionEnd

	!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
		!insertmacro MUI_DESCRIPTION_TEXT ${MAINSECTIONIDX} "${MAINSECTIONDESCRIPTION}"
		!insertmacro MUI_DESCRIPTION_TEXT ${OPTIONALSECTIONIDX} "${OPTIONALSECTIONDESCRIPTION}"
	!insertmacro MUI_FUNCTION_DESCRIPTION_END
!endif

Here is the PortableApps.comInstallerConfig.nsh which is editable by the developer to set the name, what to close, what to delete, what to keep, etc:

;Copyright 2007-2008 John T. Haller of PortableApps.com
;Website: http://PortableApps.com/

;This software is OSI Certified Open Source Software.
;OSI Certified is a certification mark of the Open Source Initiative.

;This program is free software; you can redistribute it and/or
;modify it under the terms of the GNU General Public License
;as published by the Free Software Foundation; either version 2
;of the License, or (at your option) any later version.

;This program is distributed in the hope that it will be useful,
;but WITHOUT ANY WARRANTY; without even the implied warranty of
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;GNU General Public License for more details.

;You should have received a copy of the GNU General Public License
;along with this program; if not, write to the Free Software
;Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

;EXCEPTION: Can be used with non-GPL apps distributed by PortableApps.com

;OVERVIEW: This file is used to hold configuration data for the PortableApps.comInstaller
;It should be placed in the Other\Source directory along with PortableApps.comInstaller.nsi.
;All configuration data is contained within it.  If any custom pre-install, post-install or 
;cleanup when the optional features are not selected is needed, it can be included in the
;PortableApps.comInstallerCustom.nsi which is detailed within that file.

;LAST UPDATED FOR INSTALLER VERSION: 0.10.4

;== Basic Information.  Basic information about the portable app
!define NAME "AppName Portable"
!define SHORTNAME "AppNamePortable"
!define VERSION "1.2.3.4"
!define FILENAME "AppName_Portable_1.2"
!define CHECKRUNNING "AppNamePortable.exe"
!define CLOSENAME "AppName Portable "
!define ADDONSDIRECTORYPRESERVE "NONE" ;use "NONE" for no plugins directory or relative to install directory: App\AppName\plugins
!define INSTALLERCOMMENTS "For additional details, visit PortableApps.com"
!define INSTALLERADDITIONALTRADEMARKS "" ;end this entry with a period and a space if used
!define INSTALLERLANGUAGE "English" ;one of the NSIS pre-defined languages supported: English, French, Italian, German, Japanese, SimpChinese

;== License.  For no license agreement, comment out the next line by placing a semicolon at the start of it
;!define LICENSEAGREEMENT "eula.rtf"

;== Multi-Installer.  If making an installer with no options (like additional languages), comment out the next line by placing a semicolon at the start of it
;!define MAINSECTIONTITLE "AppName Portable (English) [Required]"
!ifdef MAINSECTIONTITLE
	!define MAINSECTIONDESCRIPTION "Install the portable app"
	!define OPTIONALSECTIONTITLE "Additional Languages"
	!define OPTIONALSECTIONDESCRIPTION "Add multilingual support for this app"
	!define OPTIONALSECTIONSELECTEDAPPINFOSUFFIX "(Multilingual)"
	!define OPTIONALSECTIONNOTSELECTEDAPPINFOSUFFIX "(English)"
!endif

;== Plugin Installer.  If this is a plugin installer (not a full app installer), uncomment this line to skip adding the app size to the free space calculation and files in root directory
;!define PLUGININSTALLER "true"

;== Remove Main Directories.  If you want to remove one of the main directories before installing (useful with upgrades) uncomment the appropriate line.
;!define REMOVEAPPDIRECTORY "true"
;!define REMOVEDATADIRECTORY "true" ;Normally this should not be used
;!define REMOVEOTHERDIRECTORY "true"

;== Preserve Specific Directories.  If you are removing directories but wish to preserve a specific directory, define them here.
;!define PRESERVEDIRECTORY1 "App\Example\Plugins"
;!define PRESERVEDIRECTORY2 ""
;!define PRESERVEDIRECTORY3 ""
;!define PRESERVEDIRECTORY4 ""
;!define PRESERVEDIRECTORY5 ""
;!define PRESERVEDIRECTORY6 ""
;!define PRESERVEDIRECTORY7 ""
;!define PRESERVEDIRECTORY8 ""
;!define PRESERVEDIRECTORY9 ""
;!define PRESERVEDIRECTORY10 ""

;== Preserve Specific Files.  If you are removing directories but wish to preserve a specific file, define them here.  Wildcards work.
;!define PRESERVEFILE1 "App\Example\Plugin.dll"
;!define PRESERVEFILE2 ""
;!define PRESERVEFILE3 ""
;!define PRESERVEFILE4 ""
;!define PRESERVEFILE5 ""
;!define PRESERVEFILE6 ""
;!define PRESERVEFILE7 ""
;!define PRESERVEFILE8 ""
;!define PRESERVEFILE9 ""
;!define PRESERVEFILE10 ""

;== Remove Specific Directories.  If you wish to remove specific directories and all files within, define them here.
;!define REMOVEDIRECTORY1 "App\Example"
;!define REMOVEDIRECTORY2 ""
;!define REMOVEDIRECTORY3 ""
;!define REMOVEDIRECTORY4 ""
;!define REMOVEDIRECTORY5 ""
;!define REMOVEDIRECTORY6 ""
;!define REMOVEDIRECTORY7 ""
;!define REMOVEDIRECTORY8 ""
;!define REMOVEDIRECTORY9 ""
;!define REMOVEDIRECTORY10 ""

;== Remove Specific Files. If you wish to remove specific files, define them here.  Wildcards are acceptable: App\Example\Example.*
;!define REMOVEFILE1 "App\Example\example.exe"
;!define REMOVEFILE2 ""
;!define REMOVEFILE3 ""
;!define REMOVEFILE4 ""
;!define REMOVEFILE5 ""
;!define REMOVEFILE6 ""
;!define REMOVEFILE7 ""
;!define REMOVEFILE8 ""
;!define REMOVEFILE9 ""
;!define REMOVEFILE10 ""

;== Custom Code.  If you need custom code pre or post install or to cleanup when optional features are not selected, uncomment the appropriate lines here and include it in the PortableApps.comInstallerCustom.nsi file.
;!define USESCUSTOMCODE "true"
;!define USESCONFIGREAD "true" ;Uncomment this line if you need to use ConfigRead functions in your custom code
;!define USESCONFIGREADS "true" ;Uncomment this line if you need to use ConfigReadS functions in your custom code
;!define USESCONFIGWRITE "true" ;Uncomment this line if you need to use ConfigWrite functions in your custom code
;!define USESCONFIGWRITES "true" ;Uncomment this line if you need to use ConfigWriteS functions in your custom code

As you read through the configuration file above, you'll see that you have many options in terms of files to remove and keep. For most installers, removing the App and Other directories is sufficient when upgrading.

For applications with plugins and other files that may reside in the App directory that you wish to keep, you can define individual directories and files to preserve. This will allow you to keep, for example, the App\Example\plugins directory even though you've set the App directory to be removed.

The end result is that your installer is greatly simplified and it removes the need for most developers to have to do a WinMerge on the previous and new version, determine what files and directories to remove and then write the NSIS code to do so.

In the off chance you do need custom code, you can still set the config file to allow it and then include your custom code within a file called PortableApps.comInstallerCustom.nsh. In there, you can define macros that will be run pre install, post install and pre install when the optional section of a multi installer is not selected. These macros must be named CustomCodeOptionalCleanup, CustomCodePreInstall and CustomCodePostInstall. All are optional.

Please post any comments or suggestions.

Thanks,
John

Future additions:

  • Add multilingual options
  • Add installer generator from appinfo.ini

( categories: )

Thanks John for this great

Thanks John for this great new direction. Great idea!

This makes it tons easier so

This makes it tons easier so newbies aren't overwhelmed by the amount of code they have to edit. This is wonderful, John!

There's no place like 127.0.0.1

Great ...

... nothing more to say!

You've paid for Software more or less?
What You need is OSS!

Nice!

The only other feature I see missing is the ability to install all or part of the app to CommonFiles like in the Java portablizer or Perl Portable.

formerly rayven01

Different

That'll be handled differently. We're only gonna support a couple things in Common Files and they'll be as special installers for that. And we'll be able to bundle those installers with apps when really needed. (Think GTK+ installer inside Pidgin with local installs)

Live with purpose.

Is it possible to put an

Is it possible to put an APPNAME constant so that there's less typing to do?

Somebody give me a portable video editor... Please!
If ya wanna see my email, go to digitxpsemail.tk (at least for now!)
My dad saved over $850 a month, by switching to Geico! :P

Nope

It's been discussed a couple times and the answer is still no. I assume you're thinking that while looking at this:

!define NAME "AppName Portable"
!define SHORTNAME "AppNamePortable"
!define VERSION "1.2.3.4"
!define FILENAME "AppName_Portable_1.2"
!define CHECKRUNNING "AppNamePortable.exe"
!define CLOSENAME "AppName Portable"

So let's walk through it again. The AppName part of NAME and SHORTNAME are going to be different for several apps "Mozilla Firefox, Portable Edition" and "FirefoxPortable" for instance. The AppName part of FILENAME will be different again for some "Firefox_Portable_3.0.1_en-us" for instance. And the AppName part of CHECKRUNNING AND CLOSENAME may not even be the portable AppName it could be the regular appname "pidgin-portable.exe" and "Pidgin" for instance.

So, we can not save time with another variable and you only have to fill out this information *ONE* time for each app. So please can we stop asking about this now people? :-P :-)

Live with purpose.

Oh.

Okay, I think I'm going to drop an encyclopedia on my foot now...

Somebody give me a portable video editor... Please!
If ya wanna see my email, go to digitxpsemail.tk (at least for now!)
My dad saved over $850 a month, by switching to Geico! :P

One question:

Wouldnt it better to get rid of the ;!define REMOVEDATADIRECTORY part?
Cause it shouldnt be used anyway and if I need it I can do it via custom codes. I just think it might be better if we make it as hard as possible to delete the users Data.

"What about Love?" - "Overrated. Biochemically no different than eating large quantities of chocolate." - Al Pacino in The Devils Advocate

Multi-installer question

The old multi-installer had a part where you performed an action if the option wasn't selected, ie:

	;=== BEGIN: OPTIONAL NOT SELECTED POST-INSTALL CODE
	RMDir /r $INSTDIR\App\GnuCash\share\locale
	;=== END: OPTIONAL NOT SELECTED POST-INSTALL CODE

What's the preferred method of doing this now?

Edit: nevermind, I just noticed the end of your post. Must have missed it on first read-through.

formerly rayven01

0.10.2

0.10.2 fixes a bug where plugin installers accidentally tried to include files from the root directory

Live with purpose.

0.10.3

Version 0.10.3 allows plugin installers to now be named PortableApps.comInstallerPlugin.nsi and the associated config file to PortableApps.comInstallerPluginCustom.nsh to avoid overwriting the main app installer.

Live with purpose.

Where can I find

Where can I find PortableApps.comInstallerLANG_English.nsh?

while(alive) { God.Praise(); Code.Write(); }

I found...

I found PortableApps.comInstallerLANG_English.nsh in the Source folder in Notepad++

© Copyright of Kai

Windows XP
Home Edition SP3
2.70 GHz,248 Mb RAM,40 GB HD,64 Video Memory

Developing: Lincity-NG LMarbles and HTTrack Portable

yes

its included in each of the latest apps

"What about Love?" - "Overrated. Biochemically no different than eating large quantities of chocolate." - Al Pacino in The Devils Advocate

Why doesn't he put it here?

Why doesn't he put it here?

© Copyright of Kai

Windows XP
Home Edition SP3
2.70 GHz,248 Mb RAM,40 GB HD,64 Video Memory

Developing: Lincity-NG LMarbles and HTTrack Portable

Well

it's actually just the !insertmacro "Lang_English" part in the old installers (keep in mind we want to be multilingual ;).

Somebody give me a portable video editor... Please!
If ya wanna see my email, go to digitxpsemail.tk (at least for now!)
My dad saved over $850 a month, by switching to Geico! :P

bug?

Syntax highlighting has led me to what I believe to be a bug in 0.10.3:
Line 570:

WriteINIStr $INSTDIR\App\AppInfo\appinfo.ini" "Version" "DisplayVersion" "$0 ${OPTIONALSECTIONNOTSELECTEDAPPINFOSUFFIX}"

Should be:

WriteINIStr "$INSTDIR\App\AppInfo\appinfo.ini" "Version" "DisplayVersion" "$0 ${OPTIONALSECTIONNOTSELECTEDAPPINFOSUFFIX}"

And also line 576:

WriteINIStr $INSTDIR\App\AppInfo\appinfo.ini" "Version" "DisplayVersion" "$0 ${OPTIONALSECTIONSELECTEDAPPINFOSUFFIX}"

Should be:

WriteINIStr "$INSTDIR\App\AppInfo\appinfo.ini" "Version" "DisplayVersion" "$0 ${OPTIONALSECTIONSELECTEDAPPINFOSUFFIX}"

The first argument of the WriteINIStrs should have an opening ", but don't. Yet it still compiles!? Would it work if there was a space in their path? I don't know...

Also another thing: I'm wanting to use the plugin installer for my BPBible Portable resources package, but can't work out how to use it :-(. Can you please explain how to use it?

Chris Morgan (formerly chrism) :-)

Religion = Christian\Christadelphian
Likes_Swearing = false
Portable_App_Developer = true

Description of more than 1 components doesn't work

I'm not sure why, but when I add more then one component installer doesn't show descriptions and during compilations NSIS displays warnings: "macro:MUI_DESCRIPTION_TEXT:5".

You shouldn't be changing the

You shouldn't be changing the installer period. All you should need to edit would be:
PortableApps.comInstallerConfig.nsh
which would be(edited for my latest app, which I shall post up in about 5 minutes):

;This software is OSI Certified Open Source Software.
;OSI Certified is a certification mark of the Open Source Initiative.

;This program is free software; you can redistribute it and/or
;modify it under the terms of the GNU General Public License
;as published by the Free Software Foundation; either version 2
;of the License, or (at your option) any later version.

;This program is distributed in the hope that it will be useful,
;but WITHOUT ANY WARRANTY; without even the implied warranty of
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;GNU General Public License for more details.

;You should have received a copy of the GNU General Public License
;along with this program; if not, write to the Free Software
;Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

;EXCEPTION: Can be used with non-GPL apps distributed by PortableApps.com

;OVERVIEW: This file is used to hold configuration data for the PortableApps.comInstaller
;It should be placed in the Other\Source directory along with PortableApps.comInstaller.nsi.
;All configuration data is contained within it.  If any custom pre-install, post-install or
;cleanup when the optional features are not selected is needed, it can be included in the
;PortableApps.comInstallerCustom.nsi which is detailed within that file.

;LAST UPDATED FOR INSTALLER VERSION: 0.10.1

;== Basic Information.  Basic information about the portable app
!define NAME "ATPad Portable"
!define SHORTNAME "ATPadPortable"
!define VERSION "1.0.103.0"
!define FILENAME "ATPadPortable_Portable_1.0.103.0_Development_Test_1_en_us"
!define CHECKRUNNING "ATPadPortable.exe"
!define CLOSENAME "ATPad Portable"
!define ADDONSDIRECTORYPRESERVE "NONE" ;use "NONE" for no plugins directory or relative to install directory: App\AppName\plugins
!define INSTALLERCOMMENTS "For additional details, visit PortableApps.com"
!define INSTALLERADDITIONALTRADEMARKS "" ;end this entry with a period and a space if used
!define INSTALLERLANGUAGE "English" ;one of the NSIS pre-defined languages supported: English, French, Italian, German, Japanese, SimpChinese

;== License.  For no license agreement, comment out the next line by placing a semicolon at the start of it
;!define LICENSEAGREEMENT "eula.rtf"

;== Multi-Installer.  If making an installer with no options (like additional languages), comment out the next line by placing a semicolon at the start of it
!define MAINSECTIONTITLE "ATPad Portable (English) [Required]"
!ifdef MAINSECTIONTITLE
	!define MAINSECTIONDESCRIPTION "Install the portable app"
	!define OPTIONALSECTIONTITLE "Additional Languages"
	!define OPTIONALSECTIONDESCRIPTION "Add multilingual support for this app"
	!define OPTIONALSECTIONSELECTEDAPPINFOSUFFIX "(Multilingual)"
	!define OPTIONALSECTIONNOTSELECTEDAPPINFOSUFFIX "(English)"
!endif

;== Plugin Installer.  If this is a plugin installer (not a full app installer), uncomment this line to skip adding the app size to the free space calculation and files in root directory
;!define PLUGININSTALLER "true"

;== Remove Main Directories.  If you want to remove one of the main directories before installing (useful with upgrades) uncomment the appropriate line.
;!define REMOVEAPPDIRECTORY "true"
;!define REMOVEDATADIRECTORY "true" ;Normally this should not be used
;!define REMOVEOTHERDIRECTORY "true"

;== Preserve Specific Directories.  If you are removing directories but wish to preserve a specific directory, define them here.
;!define PRESERVEDIRECTORY1 "App\Example\Plugins"
;!define PRESERVEDIRECTORY2 ""
;!define PRESERVEDIRECTORY3 ""
;!define PRESERVEDIRECTORY4 ""
;!define PRESERVEDIRECTORY5 ""
;!define PRESERVEDIRECTORY6 ""
;!define PRESERVEDIRECTORY7 ""
;!define PRESERVEDIRECTORY8 ""
;!define PRESERVEDIRECTORY9 ""
;!define PRESERVEDIRECTORY10 ""

;== Preserve Specific Files.  If you are removing directories but wish to preserve a specific file, define them here.  Wildcards work.
;!define PRESERVEFILE1 "App\Example\Plugin.dll"
;!define PRESERVEFILE2 ""
;!define PRESERVEFILE3 ""
;!define PRESERVEFILE4 ""
;!define PRESERVEFILE5 ""
;!define PRESERVEFILE6 ""
;!define PRESERVEFILE7 ""
;!define PRESERVEFILE8 ""
;!define PRESERVEFILE9 ""
;!define PRESERVEFILE10 ""

;== Remove Specific Directories.  If you wish to remove specific directories and all files within, define them here.
;!define REMOVEDIRECTORY1 "App\Example"
;!define REMOVEDIRECTORY2 ""
;!define REMOVEDIRECTORY3 ""
;!define REMOVEDIRECTORY4 ""
;!define REMOVEDIRECTORY5 ""
;!define REMOVEDIRECTORY6 ""
;!define REMOVEDIRECTORY7 ""
;!define REMOVEDIRECTORY8 ""
;!define REMOVEDIRECTORY9 ""
;!define REMOVEDIRECTORY10 ""

;== Remove Specific Files. If you wish to remove specific files, define them here.  Wildcards are acceptable: App\Example\Example.*
;!define REMOVEFILE1 "App\Example\example.exe"
;!define REMOVEFILE2 ""
;!define REMOVEFILE3 ""
;!define REMOVEFILE4 ""
;!define REMOVEFILE5 ""
;!define REMOVEFILE6 ""
;!define REMOVEFILE7 ""
;!define REMOVEFILE8 ""
;!define REMOVEFILE9 ""
;!define REMOVEFILE10 ""

;== Custom Code.  If you need custom code pre or post install or to cleanup when optional features are not selected, uncomment the appropriate lines here and include it in the PortableApps.comInstallerCustom.nsi file.
;!define USESCUSTOMCODE "true"
;!define USESCONFIGREAD "true" ;Uncomment this line if you need to use ConfigRead functions in your custom code
;!define USESCONFIGREADS "true" ;Uncomment this line if you need to use ConfigReadS functions in your custom code
;!define USESCONFIGWRITE "true" ;Uncomment this line if you need to use ConfigWrite functions in your custom code
;!define USESCONFIGWRITES "true" ;Uncomment this line if you need to use ConfigWriteS functions in your custom code

If you need custom code, you would use:
PortableApps.comInstallerCustom.nsh

!macro CustomCodeOptionalCleanup
; none needed
!macroend
!macro CustomCodePreInstall

!macroend
!macro CustomCodePostInstall

!macroend

The installer itself SHOULD NOT BE EDITED

Good gracious! There goes a kangaroo. I must have a practice with me boomerang- Now then, slowly back
If you throw that thing at me, I'll jump right on your head.
Innit marvellous? Got a land full of kangaroos and I had to pick that one.

Bug-fixes

If you will forgive my impertinence in posting a bug-fix, here it is, and it fixes a few major bugs with components in the installer. (All of these bugs are at the very end, with the component installer section.) The bug becomes apparent if you want to have more than one word in the component installation to stick into appinfo.ini. Normally, you won't want to, as it'll stick on "(English)" or "(Multilingual)", but in the case of BPBible, I needed "(App only)" and "(App with WEB and KJV)", so it didn't work.

!ifdef MAINSECTIONTITLE
	Section /o "${OPTIONALSECTIONTITLE}"
		SetOutPath $INSTDIR
		File /r "..\..\..\${SHORTNAME}Optional1\*.*"
		StrCpy $OPTIONAL1DONE "true"
	SectionEnd

	Section "-UpdateAppInfo" SecUpdateAppInfo
		StrCmp $OPTIONAL1DONE "true" SecUpdateAppInfoOptionalSelected
			StrCmp ${OPTIONALSECTIONNOTSELECTEDAPPINFOSUFFIX} "" SecUpdateAppInfoTheEnd
				ReadINIStr $0 "$INSTDIR\App\AppInfo\appinfo.ini" "Version" "DisplayVersion"
				WriteINIStr $INSTDIR\App\AppInfo\appinfo.ini" "Version" "DisplayVersion" "$0 ${OPTIONALSECTIONNOTSELECTEDAPPINFOSUFFIX}"
			Goto SecUpdateAppInfoTheEnd

		SecUpdateAppInfoOptionalSelected:
			StrCmp ${OPTIONALSECTIONSELECTEDAPPINFOSUFFIX} "" SecUpdateAppInfoTheEnd
				ReadINIStr $0 "$INSTDIR\App\AppInfo\appinfo.ini" "Version" "DisplayVersion"
				WriteINIStr $INSTDIR\App\AppInfo\appinfo.ini" "Version" "DisplayVersion" "$0 ${OPTIONALSECTIONSELECTEDAPPINFOSUFFIX}"
		SecUpdateAppInfoTheEnd:
	SectionEnd

	!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
		!insertmacro MUI_DESCRIPTION_TEXT ${MAINSECTIONIDX} "${MAINSECTIONDESCRIPTION}"
		!insertmacro MUI_DESCRIPTION_TEXT ${OPTIONALSECTIONIDX} "${OPTIONALSECTIONDESCRIPTION}"
	!insertmacro MUI_FUNCTION_DESCRIPTION_END
!endif

With my fixes:

!ifdef MAINSECTIONTITLE
	Section /o "${OPTIONALSECTIONTITLE}"
		SetOutPath $INSTDIR
		File /r "..\..\..\${SHORTNAME}Optional1\*.*"
		StrCpy $OPTIONAL1DONE "true"
	SectionEnd

	Section "-UpdateAppInfo" SecUpdateAppInfo
		StrCmp $OPTIONAL1DONE "true" SecUpdateAppInfoOptionalSelected
			StrCmp "${OPTIONALSECTIONNOTSELECTEDAPPINFOSUFFIX}" "" SecUpdateAppInfoTheEnd
				ReadINIStr $0 "$INSTDIR\App\AppInfo\appinfo.ini" "Version" "DisplayVersion"
				WriteINIStr "$INSTDIR\App\AppInfo\appinfo.ini" "Version" "DisplayVersion" "$0 ${OPTIONALSECTIONNOTSELECTEDAPPINFOSUFFIX}"
			Goto SecUpdateAppInfoTheEnd

		SecUpdateAppInfoOptionalSelected:
			StrCmp "${OPTIONALSECTIONSELECTEDAPPINFOSUFFIX}" "" SecUpdateAppInfoTheEnd
				ReadINIStr $0 "$INSTDIR\App\AppInfo\appinfo.ini" "Version" "DisplayVersion"
				WriteINIStr "$INSTDIR\App\AppInfo\appinfo.ini" "Version" "DisplayVersion" "$0 ${OPTIONALSECTIONSELECTEDAPPINFOSUFFIX}"
		SecUpdateAppInfoTheEnd:
	SectionEnd

	!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
		!insertmacro MUI_DESCRIPTION_TEXT ${MAINSECTIONIDX} "${MAINSECTIONDESCRIPTION}"
		!insertmacro MUI_DESCRIPTION_TEXT ${OPTIONALSECTIONIDX} "${OPTIONALSECTIONDESCRIPTION}"
	!insertmacro MUI_FUNCTION_DESCRIPTION_END
!endif

Chris Morgan (formerly chrism) :-)

Religion = Christian\Christadelphian
Likes_Swearing = false
Portable_App_Developer = true

Good Catch

I must have lost those double quotes when replacing something else. It's fixed in 0.10.4.

Live with purpose.

Do I

Do I have to edit the PortableApps.comInstallerConfig.nsh every time I update?

© Copyright of Kai

Windows XP
Home Edition SP3
2.70 GHz,248 Mb RAM,40 GB HD,64 Video Memory

Developing: Lincity-NG LMarbles and HTTrack Portable

One line

Unless anything else has been changed (which John should say), you'll just need to change following line to say the latest version.

;LAST UPDATED FOR INSTALLER VERSION: 0.10.4

Chris Morgan (formerly chrism) :-)

Religion = Christian\Christadelphian
Likes_Swearing = false
Portable_App_Developer = true

No

From about 0.10.1 or .2 forward as long as the second digit is unchanged, the existing config file will work. When I add or change config stuff it'll go to 0.11.

Live with purpose.

Version Info strings

Is there any particular reason why the following line:

VIAddVersionKey PortableApps.comInstallerVersion "${PORTABLEAPPSINSTALLERVERSION}"

isn't:

VIAddVersionKey "PortableApps.com Installer Version" "${PORTABLEAPPSINSTALLERVERSION}"

also, could an additional Copyright define be added, something similar to the additional Trademarks define.

Consistency

All the others are spaceless, so it was for consistency.

No additional copyrights are added as the installer is copyright PortableApps.com.

Live with purpose.

RE: Version Info Strings

Okay, but when you right click on an executable file and click properties, on the 'Version' tab, Windows actually puts spaces in the following:

FileVersion
InternalName
LegalTrademarks
OriginalFilename
ProductName
ProductVersion
PrivateBuild
SpecialBuild

And the following:

CompanyName

become:

Company

Also, custom versioninfo strings don't get treated the same way.

Personally, I think it would be better to have spaces in it, but, it's your script.

Ah

Well, it's a bit too late now as we got lots of apps with it out as is. It'll be used by a later release of the Platform to understand how to communicate with some of the installers, so we'll be sticking with it as is. That's actually the main point of that custom string. Probably 99.99% of people will never see it, so we're not as worried about formatting.

Live with purpose.

How to compile addon/plugins installer

Hi,
how can I create an addon/plugin installer that adds files to the data directory? I have figured out how to add files to the other and app folders, but I have problems with adding files to the data folder.
The additional files should be copied to the $APPDATA folder, which is redirected to the Settingsdirectory (data\settings\appdata).

They have the Internet on computers now? - Homer Simpson

Directly

You can only add them directly (by storing them in Data\Settings\AppData within the directories) since APPDATA will be a LOCAL variable in the context the installer is run.

Live with purpose.

Yeah,

but I guess you misunderstood my problem.
If the App folder is empty, the compilation will fail.
If I add a file to the App folder, the compilation will work.
But the created package includes only the Other and App subfolders, not the Data subfolder.
Well, have I missed an option in the Installer or InstallerConfig or isn't it possible to adjust the Installer so that files in the Data subfolder will be included.

They have the Internet on computers now? - Homer Simpson

Correct

It's for plugin installers. Plugins go in the App directory. Stuff that would go in Data isn't considered plugins, so it won't work. What are you trying to do so we can see if it would make sense to update the installer code?

Live with purpose.

Nevermind :-)

I found a workaround.
I want to create an addons pack for Dia portable. It will include additional objects, shapes and sheets.
Normally you could add new ones to the $APPDATA folder, in case of Dia Portable this is Data\settings\.dia .
But you could add them to App\Dia too. If you have a local install and add them in the programdirectory, they will be available for all users.
So either I'll create an addons pack this way or I'll include the addtional files in Dev Test 2.

They have the Internet on computers now? - Homer Simpson