Page 1 of 1

Remove \\\\ from path variable

Posted: Wed Mar 23, 2005 8:44 am
by zchris
I found that the TARGETDIR variable will sometimes contain a double \\ (like c:\\Program Files\\\\MyApp)

I don't want to use

Code: Select all

Set Variable TARGETDIR = $PROGRAMFILES$$TITLE$
because I'm not sure that $PROGRAMFILES$ will always end with \\.

As a workaround I tried

Code: Select all

Set Variable TARGETDIR = $PROGRAMFILES$\\$TITLE$\\X
Extract File Folder: TARGETDIR

however this left me with a \\ at the end (c:\\Program Files\\MyApp\\).

So finally

Code: Select all

Set Variable PROGRAMFILES = $PROGRAMFILES$\\X
Extract File Folder: PROGRAMFILES
Set Variable TARGETDIR = $PROGRAMFILES$$TITLE$

seems to do the trick. Did I overlook something?

Posted: Wed Mar 23, 2005 9:26 am
by sinan
Very acute observations :D Your methods are 100% correct.

Please note that the double slashes are automatically eliminated by all InstallAware scripting functions (including default InstallAware plug-ins).

So an alternate approach would be, if I am guessing correctly, to handle double slashes in your plugins, replacing each instance of \\\\ with \\, and this would make your setup script look cleaner.

Posted: Wed Mar 23, 2005 1:00 pm
by zchris
Good idea! I'll add that to EditFile.

However it would still be nice to be able to remove the \\\\ from within IA script (I'm using $TARGETDIR$ in a messagebox that informs the user that his old database was renamed).

Could you add either a new command or an option to the Set Variable command?

Thanks.

Posted: Thu Mar 24, 2005 4:19 am
by sinan
Good suggestion - a new parameter for Extract File Path maybe?