In 64 bit operating system, for the portable app with both 32 bit and 64 bit exe, e.g. [Launch]:ProgramExecutable64
of the launcher file, but it didn't test whether the file in ProgramExecutable64 exist or not.
The solution is insert the file test before setting the string as the executable path of the program.
The following is the part of Core.nsh
that had been modified to fix this problem.
...
${GetParameters} $0
Stry $ProgramExecutable ""
${If} $Bits = 64
${If} $0 != ""
${ReadLauncherConfig} $1 Launch ProgramExecutableWhenParameters64
${If} ${FileExists} $1
Stry $ProgramExecutable $1
${EndIf}
${EndIf}
${If} $ProgramExecutable == ""
${ReadLauncherConfig} $1 Launch ProgramExecutable64
${If} ${FileExists} $1
Stry $ProgramExecutable $1
${EndIf}
${EndIf}
${EndIf}
${If} $0 != ""
${AndIf} $ProgramExecutable == ""
${ReadLauncherConfig} $1 Launch ProgramExecutableWhenParameters
${If} ${FileExists} $1
Stry $ProgramExecutable $1
${EndIf}
${EndIf}
${If} $ProgramExecutable == ""
${ReadLauncherConfig} $1 Launch ProgramExecutable
${If} ${FileExists} $1
Stry $ProgramExecutable $1
${EndIf}
${EndIf}
${If} $ProgramExecutable == ""
; Launcher file missing or missing crucial details (what am I to launch?)
MessageBox MB_OK|MB_ICONSTOP `$EXEDIR\App\AppInfo\Launcher\$BaseName.ini is missing [Launch]:ProgramExecutable - what am I to launch?`
Quit
${EndIf}
...
In addition, this means that the environment variable FullAppDir
handled by the Custom.nsh
in some applications needs to be modified and fixed, e.g. Avidemux Portable etc. The following is my fix:
${If} $Bits = 64
${AndIf} ${FileExists} "$EXEDIR\App\AppName64\AppName.exe"
${SetEnvironmentVariablesPath} FullAppDir "$EXEDIR\App\AppName64"
${Else}
${SetEnvironmentVariablesPath} FullAppDir "$EXEDIR\App\AppName"
${EndIf}
The same bug was also mentioned in my that post.
This is not a bug. If it is set to exist, it should exist. At some point we will be making a feature enhancement to allow install of either/or 32/64-bit and update the launcher to handle the nonexistence of either.
Sometimes, the impossible can become possible, if you're awesome!