Archive: Spaces in $INSTDIR path causes problems


Spaces in $INSTDIR path causes problems
When a user selects an install directory that has spaces in the path (i.e., C:\Documents and Settings it is causing me multiple problems.

For example, I have the following piece of code in my script to create a start menu item that kicks off a Java application. When there are no spaces in the install directories path, it works perfect. When there are spaces, it fails.

CreateShortCut "$SMPROGRAMS\KAST\MyJ******gram.lnk" \
"$INSTDIR\cots\jre\bin\javaw.exe" \
"-cp INSTDIR\config;$INSTDIR\lib\rjicons.jar;$INSTDIR\lib\kast-flashback.jar;$INSTDIR\lib\kast-core.jar kast.client.CommandLine watchdog" \
\
"$INSTDIR\installer\images\earth.ico" "0"

Hopefully the formatting will look ok on that.

Two things happen when there is a space:

1) The icon (earth.ico) does not show up on the start menu item.

2) The java application will not execute. Instead an error message is shown which says "Can't find main class".

Thanks,

Kennedy


Instead of using full paths to your Java archives, just use paths relative to $INSTDIR and use SetOutPath $INSTDIR before you create your shortcut so that the working directory is set.

Edit: What happens when you try to find the icon from the shortcut properties.

Stu


Isn't that exactly what I'm doing? I'm using the $INSTDIR variable in the line that creates the shortcut, so I assumed that everything was relative to that.

I think maybe I am misunderstanding the use of the term "relative". Is that the case?


Maybe you need to put quotes around the individual filenames. Check the documentation of javaw.exe.


Yes you misunderstood.

SetOutPath $INSTDIR
CreateShortCut "$SMPROGRAMS\KAST\MyJ******gram.lnk" \
"$INSTDIR\cots\jre\bin\javaw.exe" \
"-cp config;lib\rjicons.jar;lib\kast-flashback.jar;lib\kast-core.jar kast.client.CommandLine watchdog" \
"$INSTDIR\installer\images\earth.ico"


Stu

Thanks for your help Stu. I really appreciate it.

-Kennedy