!macro CustomCodePreInstall
	${If} ${FileExists} "$INSTDIR\Data\Pencil\*.*"
	${AndIfNot} ${FileExists} "$INSTDIR\Data\PencilUserProfile\*.*"
		CreateDirectory "$INSTDIR\Data\PencilUserProfile"
		CopyFiles /SILENT "$INSTDIR\App\DefaultData\PencilUserProfile\*.*" "$INSTDIR\Data\PencilUserProfile"
	${EndIf}
	
	System::Call kernel32::GetCurrentProcess()i.s
	System::Call kernel32::IsWow64Process(is,*i.r0)
	${If} $0 == 0 ;Installing on 32-bit Windows
	${AndIf} ${FileExists} "$INSTDIR\App\*.*"
		${GetParent} $INSTDIR $1
		CreateDirectory "$1\PencilProjectPortableLegacy32bit"
		CopyFiles /SILENT "$INSTDIR\*.*" "$1\PencilProjectPortableLegacy32bit"
		WriteINIStr "$1\PencilProjectPortableLegacy32bit\App\AppInfo\AppInfo.ini" "Details" "AppID" "PencilProjectPortableLegacy32bit"
		WriteINIStr "$1\PencilProjectPortableLegacy32bit\App\AppInfo\AppInfo.ini" "Details" "Name" "PencilProjectPortable (Legacy 32-bit)"
	${EndIf}
!macroend