Run Program error

Got a problem you cannot solve? Try here.
EricB
Posts: 54
Joined: Tue Mar 29, 2005 12:00 pm

Run Program error

Postby EricB » Sat Jul 16, 2005 2:37 pm

I have one project that when the "Run Program" checkbox is checked at the end of the install, tries to run the program from the temp directory rather than from the "target directory". I have checked the code, and it is: $TARGETDIR$\\AppName.exe.

Any ideas on what I can do to fix this issue?

Thanks,

Eric

sinan
Site Admin
Posts: 1020
Joined: Sat Nov 13, 2004 8:12 am
Contact:

Postby sinan » Sat Jul 16, 2005 4:54 pm

I'd say call the SetCurrentDirectory WinAPI using the Call DLL Function plug-in and change the current directory to $TARGETDIR$.

EricB
Posts: 54
Joined: Tue Mar 29, 2005 12:00 pm

Postby EricB » Sat Jul 16, 2005 5:24 pm

That is a workaround. What I want to know is why this works correctly in other setups, but not this one. From my understanding, using $TARGETDIR$\\AppName.exe should execute the program in $TARGETDIR$, not the temp directory the app is extracted to.

Is this not a correct understanding?

Thanks,

EricB

sinan
Site Admin
Posts: 1020
Joined: Sat Nov 13, 2004 8:12 am
Contact:

Postby sinan » Sun Jul 17, 2005 4:30 am

What leads you to believe that the program is running from the temp folder, as opposed to the target folder?

You're welcome to explore the situation with the CreateProcess API - it is what Run Program uses to execute your program.

EricB
Posts: 54
Joined: Tue Mar 29, 2005 12:00 pm

Postby EricB » Sun Jul 17, 2005 9:03 am

When the program starts, it comes up with an error that it can't find the configuration file and the path it gives for the file is the temp directory. When I run it from the start menu, it works just fine (finds its config file) in the directory it was installed into.

Eric

sinan
Site Admin
Posts: 1020
Joined: Sat Nov 13, 2004 8:12 am
Contact:

Postby sinan » Sun Jul 17, 2005 4:02 pm

Why not use the Run Program As command, which lets you specify a startup directory? Maybe the problem is that the startup directory is wrong (temp), but the program is actually being launched from the correct folder. I believe this would explain what we're experiencing, in fact some users reported this, so we provided the Run Program As command, that lets you specify the startup directory, which would have to be $TARGETDIR$ in this case.

EricB
Posts: 54
Joined: Tue Mar 29, 2005 12:00 pm

Postby EricB » Sun Jul 17, 2005 5:40 pm

I tried using the "Run Program As" function and get this code in the script window:
Run Program $TARGETDIR$\\AppName.exe , startup in folder $TARGETDIR$

When I click the "Finish" button, the .NET "Just-In-Time Debugging" dialog is shown with the following:
An exception 'System.TypeInitializationException' has occured in AppName.exe

To find out what "$TARGETDIR$" is set to, I inserted this code in the script window:
MessageBox: , $TARGETDIR$
When the message box is displayed, the text of the message box is:
D:\\Program Files\\\\My App Path

Can you tell me what is going on here?

Thanks,

Eric

sinan
Site Admin
Posts: 1020
Joined: Sat Nov 13, 2004 8:12 am
Contact:

Postby sinan » Sun Jul 17, 2005 8:19 pm

I cannot know why your application crashes when it is provided with a startup folder path.

If you are concerned about the double backslash, InstallAware automatically eliminates double backslashes in all path related functions before the function call executes.


Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 70 guests