Convert Path command
Posted: Fri Sep 07, 2012 3:48 am
During the installation a user can input a folder, which can be done by hand or by using a browser.
This folder can have a \ at the end of it. That's valid, but actually quite annoying when used in a command line tool.
Let me elaborate:
I'm calling a tool which replace a string in a file with another string. Using this mechanism I can use the Installer to modify configuration files.
It's called like this:
To handle the fact that paths can contain spaces I'm using loads of quotes ("), like so:
When executed it updates a config file that has the value c:\dataloc". Notice the "at the end, this happens because of the \.
I need to get rid of this ". I can do this by removing either the \ or stop using quotes.
I found that I can use Convert to Short Path to eliminate the use of quotes, but the results are strange.
I input "c:\my test\dataloc\" to which the Convert to Short Path responds with: q:\INSTAL~1\Release\UNCOMP~1\data
What gives? That not even close!!
In the manual it is suggested that the folder should already exist. In my case it doesn't, but the result is weird.
I'm using IA 12 (build Moooya.9.26.11)
I don't want the installer to create the folders. This is handled by the initializer of the installed product, besides using a DLL call to CreateDirectory can only create the 'final' directory. So if more none-existing directories are in the path, the call will fails anyhow.
Concrete question: How can I remove (if it's there) the final
By the way: I also can't use Create Folder (MSI command) since I don't want these folders to disappear after an uninstall.
This folder can have a \ at the end of it. That's valid, but actually quite annoying when used in a command line tool.
Let me elaborate:
I'm calling a tool which replace a string in a file with another string. Using this mechanism I can use the Installer to modify configuration files.
It's called like this:
Code: Select all
MyTool.exe configfile pattern requiredValueCode: Select all
Run Program $SUPPORTDIR$\MyTool.exe "$TARGETDIR$\MyConfigFile.xml" %DATALOC% "$PathToDataLoc$"I need to get rid of this ". I can do this by removing either the \ or stop using quotes.
I found that I can use Convert to Short Path to eliminate the use of quotes, but the results are strange.
I input "c:\my test\dataloc\" to which the Convert to Short Path responds with: q:\INSTAL~1\Release\UNCOMP~1\data
What gives? That not even close!!
In the manual it is suggested that the folder should already exist. In my case it doesn't, but the result is weird.
I'm using IA 12 (build Moooya.9.26.11)
I don't want the installer to create the folders. This is handled by the initializer of the installed product, besides using a DLL call to CreateDirectory can only create the 'final' directory. So if more none-existing directories are in the path, the call will fails anyhow.
Concrete question: How can I remove (if it's there) the final
By the way: I also can't use Create Folder (MSI command) since I don't want these folders to disappear after an uninstall.