Archive: Problems executing file after installation


Problems executing file after installation
My software has a Windows desktop component and also installs some files on a Palm OS device. When the installer finishes installing the Windows application I want it to execute another installer I've already built (not NSIS) to start the Palm software installation. I've read the manual and a bunch of posts on this and am mystified as to why I haven't succeeded.

Briefly, the problem is that when the Palm installer gets called it behaves like it can't find the first file that it needs to install and it crashes. I have verified that the file is there and after the Palm installer has crashed I can browse to the executable for it and perform the installation manually.

Note: the Palm installer.exe and the files it needs to do its thing are all installed by the NSIS installer.

What could be the problem here?

David


The working directory is probably not set right. The other installer probably looks there for the files, and since it isn't set properly, it can't find them. Use SetOutPath to set the working directory.


Originally posted by kichik
The working directory is probably not set right.... Use SetOutPath to set the working directory.
Hmmm. Thanks for the suggestion. I probably did need to do that, but even when I do there's still the same problem. Another strange thing I just noticed (and should have noticed earlier) is that a MessageBox I call prior to my Exec command doesn't display, even thought the Exec command following it is clearly running.

Here's the function I'm calling by defining MUI_PAGE_CUSTOMFUNCTION_LEAVE PalmInstall. What's happening here with the IntCmp calls is I'm checking which version(s) of the Palm software they decided to install in a previous dialog. (Note: I've tried putting this define MUI_PAGE_CUSTOMFUNCTION_LEAVE before the MUI_PAGE_INSTFILES macro, before the MUI_PAGE_FINISH macro, and I've also tried putting the body of the function in Function .onInstSuccess, all with the same result.)

Function PalmInstall

IntCmp PALM_OS_2_3_4 1 OS234 next
OS234:
IntCmp PALM_OS_5 1 msgBoth msg234
msgBoth:
MessageBox MB_ICONINFORMATION|MB_OK "EpiSurveyor Setup will now install the \
software to your Palm OS devices. Since you have opted to install the versions \
for both Palm OS 5 and for earlier Palm OS devices the Palm installation dialog \
will run twice. If prompted to select the devices (HotSync users) to install \
to, take care to select the devices whose Palm OS version matches the one being \
installed in the current dialog."
Goto install234
msg234:
MessageBox MB_ICONINFORMATION|MB_OK "EpiSurveyor Setup will now install the \
software to your Palm OS devices. You have opted to install the version \
for Palm OS 2, 3, and 4 without 16-bit color. If prompted to select \
the devices (HotSync users) to install to, take care to select devices that \
use a compatible version of Palm OS."
install234:
SetOutPath "$INSTDIR\engine\os2_3_4"
Exec '"$INSTDIR\engine\os2_3_4\pInstaller.exe"'
next:
IntCmp PALM_OS_5 1 OS5 done
OS5:
; if we already installed the OS 2-3-4 version we don't need another message
IntCmp PALM_OS_2_3_4 1 install5 msg5
msg5:
MessageBox MB_ICONINFORMATION|MB_OK "EpiSurveyor Setup will now install the \
software to your Palm OS devices. You have opted to install the version \
for Palm OS 5 and OS 4 with 16-bit color. If prompted to select \
the devices (HotSync users) to install to, take care to select devices that \
use a compatible version of Palm OS."
install5:
SetOutPath "$INSTDIR\engine\os5"
Exec '"$INSTDIR\engine\os5\pInstaller.exe"'
done:
FunctionEnd


David

The best place to put this code would probably be in a section of its own, or the last section.

Try replacing the Exec instruction with MessageBox. When the message box shows up, manually execute the installer and see if it works or not. It might be something that executes later one that it's missing.


Originally posted by kichik
The working directory is probably not set right. The other installer probably looks there for the files, and since it isn't set properly, it can't find them. Use SetOutPath to set the working directory.
Think it would be worth it to add a check and set a compiler warning if Exec is used when $OUTDIR is not the same as the target EXE's parent directory?

I just ran into this issue also. I know it's because of my sloppiness, but a compiler check could alert people to this potential problem at build time.

I have a problem similar.
If $INSTDIR is MyDocs and:
SetOutPath "$INSTDIR\engine\os5"
Exec '"$INSTDIR\engine\os5\pInstaller.exe"'

The pInstaller.exe will run from ns..$temp, NOT from $INSTDIR.


Originally posted by Mark Nascimento
I have a problem similar.
If $INSTDIR is MyDocs and:
SetOutPath "$INSTDIR\engine\os5"
Exec '"$INSTDIR\engine\os5\pInstaller.exe"'

The pInstaller.exe will run from ns..$temp, NOT from $INSTDIR.
Mark, this may be happening because MyDocs is not static. It can be different values based on what SetShellVarContext points to. You may want to verify that it is set to the correct value (all versus current) and MessageBox $OUTDIR just before your Exec instruction.

Thank You.
Solved.


Originally posted by dienjd
Think it would be worth it to add a check and set a compiler warning if Exec is used when $OUTDIR is not the same as the target EXE's parent directory?
Nevermind, this isn't possible since both of these are set at runtime :) Would be possible I guess in a script to wrap Exec in a routine that verifies this.