!define BUILDSCRIPTVERSION ` version="1.3.4.0" ` ;Project compiler and U3P builder ;Copyright (C) 2009 qwertymodo ;U3 Smart Technology is a trademark of U3 LLC ;The Uop3n Smart Apps Project is in no way related to or endorsed by U3 LLC ;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. ;Compiling this script will compile the U3 Package, provided that ;the correct directory structure has already been created and that ;the 7-zip standalone 7za.exe is located in the NSIS plugins folder ;To compile this script, first copy the current U3 Package (something.u3p) to ;a directory OUTSIDE of your U3 install path and rename it from .u3p to ;.zip then extract the entire package. You cannot compile it from within ;the U3 directory. !searchparse /file AppInfo.cfg ` AppInfoVersion=" ` CFG_VER_MAJOR ` . ` CFG_VER_MINOR ` . ` CFG_UPDATE ` . ` CFG_REVISION ` " ` !searchparse ${BUILDSCRIPTVERSION} ` version=" ` SCRIPT_VER_MAJOR ` . ` SCRIPT_VER_MINOR ` . ` SCRIPT_UPDATE ` . ` SCRIPT_REVISION ` " ` !if "${CFG_VER_MAJOR}.${CFG_VER_MINOR} " != "${SCRIPT_VER_MAJOR}.${SCRIPT_VER_MINOR} " !error "Incompatible AppInfo.cfg file. Please use AppInfo.cfg version ${SCRIPT_VER_MAJOR}.${SCRIPT_VER_MINOR}.${SCRIPT_UPDATE}.x " !endif !if ${CFG_UPDATE} < ${SCRIPT_UPDATE} !error "Incompatible AppInfo.cfg file. Please use AppInfo.cfg version ${SCRIPT_VER_MAJOR}.${SCRIPT_VER_MINOR}.${SCRIPT_UPDATE}.x " !endif !searchparse /file AppInfo.cfg ` LauncherSourceFile=" ` PROGRAMSCRIPT ` " ` !searchparse /file AppInfo.cfg ` MainAppEXE=" ` APPEXE ` " ` !searchparse /file AppInfo.cfg ` AppName=" ` APPNAME ` " ` !searchparse /file AppInfo.cfg ` Author=" ` AUTHOR ` " ` !searchparse /file AppInfo.cfg ` Website=" ` WEBSITE ` " ` !searchparse /file AppInfo.cfg ` UUID=" ` UUID ` " ` !searchparse /file AppInfo.cfg ` FullDescription=" ` FULLDESCRIPTION ` " ` !searchparse /file AppInfo.cfg ` ShortDescription=" ` SHORTDESCRIPTION ` " ` !searchparse /file AppInfo.cfg ` AppDataUpdateMethod=" ` APPDATAUPDATE ` " ` !searchparse /file AppInfo.cfg ` DeviceExecUpdateMethod=" ` DEVICEEXECUPDATE ` " ` !searchparse /file AppInfo.cfg ` AutoRun=" ` AUTORUN ` " ` !searchparse /file AppInfo.cfg ` AppStartCommand=" ` APPSTARTCOMMAND ` " ` !searchparse /file AppInfo.cfg ` AppStartParams=" ` APPSTARTPARAMS ` " ` !searchparse /file AppInfo.cfg ` AppStopCommand=" ` APPSTOPCOMMAND ` " ` !searchparse /file AppInfo.cfg ` AppStopParams=" ` APPSTOPPARAMS ` " ` !searchparse /file AppInfo.cfg ` HostCleanupCommand=" ` HOSTCLEANUPCOMMAND ` " ` !searchparse /file AppInfo.cfg ` HostCleanupParams=" ` HOSTCLEANUPPARAMS ` " ` !searchparse /file AppInfo.cfg ` AppVersion=" ` APPVERSION ` " ` !searchparse /file AppInfo.cfg ` RequiredPlugins=" ` PLUGINS ` " ` ;Doesn't work yet... :( !macro CheckForU3Path !define SCRIPT checkpath.tmp !define OUTPUT output.tmp !appendfile "${SCRIPT} " ` SilentInstall Silent $\r$

` !appendfile "${SCRIPT} " ` AutoCloseWindow True $\r$

` !appendfile "${SCRIPT} " ` RequestExecutionLevel User $\r$

` !appendfile "${SCRIPT} " ` OutFile ${SCRIPT}.exe $\r$

` !appendfile "${SCRIPT} " ` Section "" $\r$

` !appendfile "${SCRIPT} " ` FileOpen $9 ${OUTPUT} w $\r$

` !appendfile "${SCRIPT} " ` StrLen $0 $EXEDIR $\r$

` !appendfile "${SCRIPT} " ` IntCmp $0 69 "" End "" $\r$

` !appendfile "${SCRIPT} " ` StrCpy $0 $EXEDIR 66 3 $\r$

` !appendfile "${SCRIPT} " ` StrCmp $0 "System\Apps\${UUID}\Exec\Other\Source" "" End $\r$

` !appendfile "${SCRIPT} " ` FileWrite $9 '!define INU3PATH' $\r$

` !appendfile "${SCRIPT} " ` End: $\r$

` !appendfile "${SCRIPT} " ` FileClose $9 $\r$

` !appendfile "${SCRIPT} " ` SectionEnd $\r$

` !system '"${NSISDIR}\makensis.exe" ${SCRIPT}' = 0 !system '"${SCRIPT}.exe"' = 0 !include ${OUTPUT} !delfile ${OUTPUT} !delfile ${SCRIPT} !delfile ${SCRIPT} .exe !undef SCRIPT !undef OUTPUT !ifdef INU3PATH !error "The U3 Package cannot be compiled from within the U3 directory. Doing so would break your current installation. Aborting. " !endif !macroend !macro CheckForFile DIR FILE DISPLAYNAME !tempfile SCRIPT2 !tempfile OUTPUT2 !appendfile "${SCRIPT2} " ` SilentInstall Silent $\r$

` !appendfile "${SCRIPT2} " ` AutoCloseWindow True $\r$

` !appendfile "${SCRIPT2} " ` RequestExecutionLevel user $\r$

` !appendfile "${SCRIPT2} " ` OutFile ${SCRIPT2}.exe $\r$

` !appendfile "${SCRIPT2} " ` Section "" $\r$

` !appendfile "${SCRIPT2} " ` FileOpen $R0 "${OUTPUT2}" w $\r$

` !appendfile "${SCRIPT2} " ` IfFileExists "${DIR}\${FILE}" 0 +2 $\r$

` !appendfile "${SCRIPT2} " ` FileWrite $R0 '!define "${FILE}Exists"' $\r$

` !appendfile "${SCRIPT2} " ` FileClose $R0 $\r$

` !appendfile "${SCRIPT2} " ` SectionEnd ` !system '"${NSISDIR}\makensis.exe" ${SCRIPT2}' = 0 !system '"${SCRIPT2}.exe"' = 0 !include ${OUTPUT2} !delfile ${OUTPUT2} !delfile "${SCRIPT2} " !delfile "${SCRIPT2}.exe " !undef SCRIPT2 !undef OUTPUT2 !ifndef "${FILE}Exists " !error "${DISPLAYNAME} could not be found. Please install ${FILE} to ${DIR}. " !endif !macroend !macro CheckForRequiredPlugins !tempfile SCRIPT !tempfile OUTPUT !appendfile "${SCRIPT} " ` SilentInstall Silent $\r$

` !appendfile "${SCRIPT} " ` AutoCloseWindow True $\r$

` !appendfile "${SCRIPT} " ` RequestExecutionLevel user $\r$

` !appendfile "${SCRIPT} " ` OutFile '${SCRIPT}.exe' $\r$

` !appendfile "${SCRIPT} " ` !macro SplitString STRING $\r$

` !appendfile "${SCRIPT} " ` Push "${STRING}" $\r$

` !appendfile "${SCRIPT} " ` Call Split $\r$

` !appendfile "${SCRIPT} " ` !macroend $\r$

` !appendfile "${SCRIPT} " ` Function Split $\r$

` !appendfile "${SCRIPT} " ` FileOpen $R0 "${OUTPUT}" w $\r$

` !appendfile "${SCRIPT} " ` StrCmp $0 "" Done $\r$

` !appendfile "${SCRIPT} " ` Pop $0 $\r$

` !appendfile "${SCRIPT} " ` NewSubstring: $\r$

` !appendfile "${SCRIPT} " ` StrCpy $2 "" $\r$

` !appendfile "${SCRIPT} " ` StrCpy $3 "" $\r$

` !appendfile "${SCRIPT} " ` SubstringLoop: $\r$

` !appendfile "${SCRIPT} " ` StrCmp $0 "" Found $\r$

` !appendfile "${SCRIPT} " ` StrCpy $9 $0 1 $\r$

` !appendfile "${SCRIPT} " ` StrCpy $0 $0 "" 1 $\r$

` !appendfile "${SCRIPT} " ` StrCmp $9 "," Found $\r$

` !appendfile "${SCRIPT} " ` StrCpy $2 " $2$9 " $\r$

` !appendfile "${SCRIPT} " ` Goto SubstringLoop $\r$

` !appendfile "${SCRIPT} " ` Found: $\r$

` !appendfile "${SCRIPT} " ` StrCpy $9 $2 1 $\r$

` !appendfile "${SCRIPT} " ` StrCpy $2 $2 "" 1 $\r$

` !appendfile "${SCRIPT} " ` StrCmp $9 "|" Separated $\r$

` !appendfile "${SCRIPT} " ` StrCpy $3 " $3$9 " $\r$

` !appendfile "${SCRIPT} " ` Goto Found $\r$

` !appendfile "${SCRIPT} " ` Separated: $\r$

` !appendfile "${SCRIPT} " ` FileWrite $R0 '!insertmacro CheckForFile " ${NSISDIR} \plugins" " $3 " " $2 "' $\r$

` !appendfile "${SCRIPT} " ` FileWriteByte $R0 "13" $\r$

` !appendfile "${SCRIPT} " ` FileWriteByte $R0 "10" $\r$

` !appendfile "${SCRIPT} " ` StrCmp $0 "" "" NewSubstring $\r$

` !appendfile "${SCRIPT} " ` FileWrite $R0 '!insertmacro CheckForFile " ${NSISDIR} \plugins" " $3 " " $2 "' $\r$

` !appendfile "${SCRIPT} " ` FileWriteByte $R0 "13" $\r$

` !appendfile "${SCRIPT} " ` FileWriteByte $R0 "10" $\r$

` !appendfile "${SCRIPT} " ` Done: $\r$

` !appendfile "${SCRIPT} " ` FileWrite $R0 '!insertmacro CheckForFile " ${NSISDIR} " "plugins\7za.exe" "7-zip standalone executable"' $\r$

` !appendfile "${SCRIPT} " ` FileWriteByte $R0 "13" $\r$

` !appendfile "${SCRIPT} " ` FileWriteByte $R0 "10" $\r$

` !appendfile "${SCRIPT} " ` FileClose $R0 $\r$

` !appendfile "${SCRIPT} " ` FunctionEnd $\r$

` !appendfile "${SCRIPT} " ` Section "" $\r$

` !appendfile "${SCRIPT} " ` !insertmacro SplitString "${PLUGINS}" $\r$

` !appendfile "${SCRIPT} " ` SectionEnd ` !system '"${NSISDIR}\makensis.exe" ${SCRIPT}' = 0 !system '"${SCRIPT}.exe"' = 0 !include ${OUTPUT} !delfile ${OUTPUT} !delfile "${SCRIPT} " !delfile "${SCRIPT}.exe " !undef SCRIPT !undef OUTPUT !macroend !macro GenerateManifest ;Get current version and estimate size !define FILE "..\..\..\..\${APPEXE} " !tempfile SCRIPT !tempfile OUTPUT !appendfile "${SCRIPT} " ` SilentInstall Silent $\r$

` !appendfile "${SCRIPT} " ` AutoCloseWindow True $\r$

` !appendfile "${SCRIPT} " ` RequestExecutionLevel user $\r$

` !appendfile "${SCRIPT} " ` OutFile ${SCRIPT}.exe $\r$

` !appendfile "${SCRIPT} " ` !include FileFunc.nsh $\r$

` !appendfile "${SCRIPT} " ` !insertmacro GetSize $\r$

` !appendfile "${SCRIPT} " ` !include TextFunc.nsh $\r$

` !appendfile "${SCRIPT} " ` !insertmacro ConfigWrite $\r$

` !appendfile "${SCRIPT} " ` Var U3PACKAGE $\r$

` !appendfile "${SCRIPT} " ` Section "" $\r$

` !appendfile "${SCRIPT} " ` FileOpen $R9 "${OUTPUT}" w $\r$

` !if "${APPVERSION} " == " " !undef APPVERSION !appendfile "${SCRIPT} " ` GetDllVersion "${FILE}" $R0 $R1 $\r$

` !appendfile "${SCRIPT} " ` IntOp $R2 $R0 / 0x00010000 $\r$

` !appendfile "${SCRIPT} " ` IntOp $R3 $R0 & 0x0000FFFF $\r$

` !appendfile "${SCRIPT} " ` IntOp $R4 $R1 / 0x00010000 $\r$

` !appendfile "${SCRIPT} " ` IntOp $R5 $R1 & 0x0000FFFF $\r$

` !appendfile "${SCRIPT} " ` StrCpy $R1 " $R2 . $R3 . $R4 . $R5 " $\r$

` !appendfile "${SCRIPT} " ` FileWrite $R9 '!define PADDEDVERSION VERSION=" $R1 "' $\r$

` !appendfile "${SCRIPT} " ` FileWriteByte $R9 "13" $\r$

` !appendfile "${SCRIPT} " ` FileWriteByte $R9 "10" $\r$

` !else !define PADDEDVERSION 'VERSION=$\"${APPVERSION}$\"' !searchparse "${PADDEDVERSION} " ` VERSION=" ` R2 ` . ` R3 ` . ` R4 ` . ` R5 ` " ` !appendfile "${SCRIPT} " ` StrCpy $R2 "${R2}" $\r$

` !appendfile "${SCRIPT} " ` StrCpy $R3 "${R3}" $\r$

` !appendfile "${SCRIPT} " ` StrCpy $R4 "${R4}" $\r$

` !appendfile "${SCRIPT} " ` StrCpy $R5 "${R5}" $\r$

` !endif !appendfile "${SCRIPT} " ` StrCpy $U3PACKAGE "${APPNAME}_ $R2 . $R3 . $R4 " $\r$

` !appendfile "${SCRIPT} " ` StrCmp $R5 0 +2 $\r$

` !appendfile "${SCRIPT} " ` StrCpy $U3PACKAGE " $U3PACKAGE . $R5 " $\r$

` !appendfile "${SCRIPT} " ` StrCpy $U3PACKAGE " $U3PACKAGE .u3p" $\r$

` !appendfile "${SCRIPT} " ` ${GetSize} " $EXEDIR \..\..\..\..\" "/M= $U3PACKAGE /S=0M" $0 $1 $2 $\r$

` !appendfile "${SCRIPT} " ` ${GetSize} " $EXEDIR \..\..\..\..\Device" "/S=0M" $1 $2 $3 $\r$

` !appendfile "${SCRIPT} " ` IntOp $0 $0 + $1 $\r$

` !appendfile "${SCRIPT} " ` IntOp $0 $0 * 6 $\r$

` !appendfile "${SCRIPT} " ` IntOp $0 $0 / 5 $\r$

` !appendfile "${SCRIPT} " ` StrCmp $0 "0" 0 +2 $\r$

` !appendfile "${SCRIPT} " ` StrCpy $0 1 $\r$

` !appendfile "${SCRIPT} " ` FileWrite $R9 '!define PADDEDSIZE SIZE= $\" $0 $\" ' $\r$

` !appendfile "${SCRIPT} " ` SectionEnd ` !system '"${NSISDIR}\makensis.exe" ${SCRIPT}' = 0 !system '"${SCRIPT}.exe"' = 0 !include ${OUTPUT} !searchparse ${PADDEDVERSION} ` VERSION=" ` APPVERSION ` " ` !undef PADDEDVERSION !searchparse ${PADDEDSIZE} ` SIZE=" ` SIZE ` " ` !undef PADDEDSIZE !delfile ${OUTPUT} !delfile "${SCRIPT} " !delfile "${SCRIPT}.exe " !undef SCRIPT !undef FILE !undef OUTPUT !if "${APPVERSION} " == "0.0.0.0 " !error "Unable to detect app version. Please manually set AppVersion in AppInfo.cfg. " !endif !tempfile SCRIPT !appendfile "${SCRIPT} " ` SilentInstall Silent $\r$

` !appendfile "${SCRIPT} " ` AutoCloseWindow True $\r$

` !appendfile "${SCRIPT} " ` RequestExecutionLevel user $\r$

` !appendfile "${SCRIPT} " ` OutFile "${SCRIPT}.exe" $\r$

` !appendfile "${SCRIPT} " ` Section "" $\r$

` !appendfile "${SCRIPT} " ` FileOpen $R9 "..\..\..\..\Manifest\manifest.u3i" w $\r$

` !appendfile "${SCRIPT} " ` FileWrite $R9 '<u3manifest version="1.0">' $\r$

` !appendfile "${SCRIPT} " ` FileWriteByte $R9 "13" $\r$

` !appendfile "${SCRIPT} " ` FileWriteByte $R9 "10" $\r$

` !appendfile "${SCRIPT} " ` FileWrite $R9 ' $\t <application uuid="${UUID}" version="${APPVERSION}">' $\r$

` !appendfile "${SCRIPT} " ` FileWriteByte $R9 "13" $\r$

` !appendfile "${SCRIPT} " ` FileWriteByte $R9 "10" $\r$

` !appendfile "${SCRIPT} " ` FileWrite $R9 ' $\t$\t <icon>appicon.ico</icon>' $\r$

` !appendfile "${SCRIPT} " ` FileWriteByte $R9 "13" $\r$

` !appendfile "${SCRIPT} " ` FileWriteByte $R9 "10" $\r$

` !appendfile "${SCRIPT} " ` FileWrite $R9 ' $\t$\t <name>${APPNAME}</name>' $\r$

` !appendfile "${SCRIPT} " ` FileWriteByte $R9 "13" $\r$

` !appendfile "${SCRIPT} " ` FileWriteByte $R9 "10" $\r$

` !appendfile "${SCRIPT} " ` FileWrite $R9 " $\t$\t <description>${FULLDESCRIPTION}</description>" $\r$

` !appendfile "${SCRIPT} " ` FileWriteByte $R9 "13" $\r$

` !appendfile "${SCRIPT} " ` FileWriteByte $R9 "10" $\r$

` !if "${SHORTDESCRIPTION} " != " " !appendfile "${SCRIPT} " ` FileWrite $R9 " $\t$\t <shortDescription>${SHORTDESCRIPTION}</shortDescription>" $\r$

` !appendfile "${SCRIPT} " ` FileWriteByte $R9 "13" $\r$

` !appendfile "${SCRIPT} " ` FileWriteByte $R9 "10" $\r$

` !endif !appendfile "${SCRIPT} " ` FileWrite $R9 ' $\t$\t <vendor url="${WEBSITE}">${AUTHOR}</vendor>' $\r$

` !appendfile "${SCRIPT} " ` FileWriteByte $R9 "13" $\r$

` !appendfile "${SCRIPT} " ` FileWriteByte $R9 "10" $\r$

` !appendfile "${SCRIPT} " ` FileWrite $R9 ' $\t$\t <options>' $\r$

` !appendfile "${SCRIPT} " ` FileWriteByte $R9 "13" $\r$

` !appendfile "${SCRIPT} " ` FileWriteByte $R9 "10" $\r$

` !if "${AUTORUN} " == "true " !appendfile "${SCRIPT} " ` FileWrite $R9 ' $\t$\t$\t <autorun />' $\r$

` !appendfile "${SCRIPT} " ` FileWriteByte $R9 "13" $\r$

` !appendfile "${SCRIPT} " ` FileWriteByte $R9 "10" $\r$

` !endif !appendfile "${SCRIPT} " ` FileWrite $R9 ' $\t$\t$\t <minFreeSpace>${SIZE}</minFreeSpace>' $\r$

` !appendfile "${SCRIPT} " ` FileWriteByte $R9 "13" $\r$

` !appendfile "${SCRIPT} " ` FileWriteByte $R9 "10" $\r$

` !appendfile "${SCRIPT} " ` FileWrite $R9 ' $\t$\t$\t <upgrade appData="${APPDATAUPDATE}" deviceExec="${DEVICEEXECUPDATE}"/>' $\r$

` !appendfile "${SCRIPT} " ` FileWriteByte $R9 "13" $\r$

` !appendfile "${SCRIPT} " ` FileWriteByte $R9 "10" $\r$

` !appendfile "${SCRIPT} " ` FileWrite $R9 ' $\t$\t </options>' $\r$

` !appendfile "${SCRIPT} " ` FileWriteByte $R9 "13" $\r$

` !appendfile "${SCRIPT} " ` FileWriteByte $R9 "10" $\r$

` !appendfile "${SCRIPT} " ` FileWrite $R9 ' $\t$\t <i18n></i18n>' $\r$

` !appendfile "${SCRIPT} " ` FileWriteByte $R9 "13" $\r$

` !appendfile "${SCRIPT} " ` FileWriteByte $R9 "10" $\r$

` !appendfile "${SCRIPT} " ` FileWrite $R9 ' $\t </application>' $\r$

` !appendfile "${SCRIPT} " ` FileWriteByte $R9 "13" $\r$

` !appendfile "${SCRIPT} " ` FileWriteByte $R9 "10" $\r$

` !appendfile "${SCRIPT} " ` FileWrite $R9 ' $\t$\t <actions>' $\r$

` !appendfile "${SCRIPT} " ` FileWriteByte $R9 "13" $\r$

` !appendfile "${SCRIPT} " ` FileWriteByte $R9 "10" $\r$

` !appendfile "${SCRIPT} " ` FileWrite $R9 ' $\t$\t$\t <appStart cmd="${APPSTARTCOMMAND}"> ${APPSTARTPARAMS} </appStart>' $\r$

` !appendfile "${SCRIPT} " ` FileWriteByte $R9 "13" $\r$

` !appendfile "${SCRIPT} " ` FileWriteByte $R9 "10" $\r$

` !if "${APPSTOPCOMMAND} " != " " !appendfile "${SCRIPT} " ` FileWrite $R9 ' $\t$\t$\t <appStop cmd="${APPSTOPCOMMAND}"> ${APPSTOPPARAMS} </appStop>' $\r$

` !appendfile "${SCRIPT} " ` FileWriteByte $R9 "13" $\r$

` !appendfile "${SCRIPT} " ` FileWriteByte $R9 "10" $\r$

` !endif !if "${HOSTCLEANUPCOMMAND} " != " " !appendfile "${SCRIPT} " ` FileWrite $R9 ' $\t$\t$\t <hostCleanUp cmd="${HOSTCLEANUPCOMMAND}"> ${HOSTCLEANUPPARAMS} </hostCleanUp>' $\r$

` !appendfile "${SCRIPT} " ` FileWriteByte $R9 "13" $\r$

` !appendfile "${SCRIPT} " ` FileWriteByte $R9 "10" $\r$

` !endif !appendfile "${SCRIPT} " ` FileWrite $R9 ' $\t$\t </actions>' $\r$

` !appendfile "${SCRIPT} " ` FileWriteByte $R9 "13" $\r$

` !appendfile "${SCRIPT} " ` FileWriteByte $R9 "10" $\r$

` !appendfile "${SCRIPT} " ` FileWrite $R9 '</u3manifest>' $\r$

` !appendfile "${SCRIPT} " ` FileClose $R9 $\r$

` !appendfile "${SCRIPT} " ` SectionEnd ` !system '"${NSISDIR}\makensis.exe" ${SCRIPT}' = 0 !system '"${SCRIPT}.exe"' = 0 !delfile "${SCRIPT} " !delfile "${SCRIPT}.exe " !undef SCRIPT !macroend ;**********Execution Start Point********** !insertmacro CheckForU3Path !insertmacro CheckForRequiredPlugins !searchparse /file AppInfo.cfg ` LauncherSourceFile=" ` PROGRAMSCRIPT ` " ` !system '"${NSISDIR}\makensis.exe" ${PROGRAMSCRIPT}' = 0 !insertmacro GenerateManifest !searchparse /file "..\..\..\..\Manifest\manifest.u3i " ` <name> ` NAME ` </name> ` !searchreplace NAME "${NAME} " " " "_ " !searchparse /file "..\..\..\..\Manifest\manifest.u3i " ` <application uuid=" ` UUID ` " version=" ` VER_MAJOR ` . ` VER_MINOR ` . ` VER_UPDATE ` . ` U3_REVISION ` "> ` !define FILENAME "${NAME}_${VER_MAJOR}.${VER_MINOR}.${VER_UPDATE}_rev_${U3_REVISION}.u3p " !searchreplace FILENAME "${FILENAME} " "_rev_0.u3p " ".u3p " ;Add a useless file to the U3 Package to make sure it exists, because if it doesn't, !delfile produces an error !system '"${NSISDIR}\plugins\7za.exe" a -tzip "..\..\..\..\${FILENAME}" ".\BuildU3P.nsi"' !delfile "..\..\..\..\${FILENAME} " !system '"${NSISDIR}\plugins\7za.exe" a -tzip "..\..\..\..\${FILENAME}" "..\..\..\..\Data"' !system '"${NSISDIR}\plugins\7za.exe" a -tzip "..\..\..\..\${FILENAME}" "..\..\..\..\Device"' !system '"${NSISDIR}\plugins\7za.exe" a -tzip "..\..\..\..\${FILENAME}" "..\..\..\..\Host"' !system '"${NSISDIR}\plugins\7za.exe" a -tzip "..\..\..\..\${FILENAME}" "..\..\..\..\Manifest"' ;Update package size in manifest !insertmacro GenerateManifest !system '"${NSISDIR}\plugins\7za.exe" a -tzip "..\..\..\..\${FILENAME}" "..\..\..\..\Manifest"' SilentInstall Silent AutoCloseWindow True RequestExecutionLevel user OutFile "$%TEMP%\deleteme " Section " " SectionEnd