Edit INI File: Writing Backslashes

Got a problem you cannot solve? Try here.
MikeFieger
Posts: 52
Joined: Thu Jan 26, 2006 9:09 am

Edit INI File: Writing Backslashes

Postby MikeFieger » Wed Mar 22, 2006 8:50 am

Why can´t I write a string that contains a double backslash (\\\\) to an ini file?

I tried writing the string via a variable as well as hardcoded to the 'Edit INI File' command.
The result always has only one backslash no matter how many backslashes I try to write.

This pretty much looks like a bug to me :evil:

Why is this and is there a workaround for this?

MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Postby MichaelNesmith » Wed Mar 22, 2006 7:24 pm

This is actually not a bug, but a feature. InstallAware automatically removes double-backslashes found in variables for you, and replaces them with a single backslash. This is provided as a convenience for when you are forming paths, like $TARGETDIR$\\subfolder. Normally this might be folder\\\\subfolder, or folder\\subfolder, but by eliminating the double backslashes, you don't need to worry about it.

Unfortunately in your case, this is preventing you from writing the actual data you want to write! Sorry! Maybe we can define a special variable to represent a double-backslash in the next version.

Also, you may use the Write to Text File command and hard code a double-backslash. In this case the double-backslash survives (as long as its not in a variable).
Michael Nesmith
InstallAware
Home of The Next Generation MSI Installer
Get your free copy today - http://www.installaware.com/

MikeFieger
Posts: 52
Joined: Thu Jan 26, 2006 9:09 am

Postby MikeFieger » Thu Mar 23, 2006 2:49 am

Thank you for your answer.

I would be glad if you could solve this problem in a future release.

Providing a special variable containing two backslashes would work for me but I think this is still not the best solution because one could still not write, for example, 3 or more backslashes to an ini file. (I know this is hypothetic, but hey, a good installer should not restrict the user ;-))

So I think it would perhaps be better to make one backslash out of two. This would keep the current logic, but also enable the customer to write 2 backslashes by typing in 4 (...and 3 by typing 6 and so on).

Please let me know if you plan to solve this problem as I don´t know how I coud use the 'Write to TextFile' command to edit a line in the middle of an ini file.

Greetings,

Mike

MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Postby MichaelNesmith » Thu Mar 23, 2006 1:02 pm

Yes, this will be addressed! Thanks for letting us know.
Michael Nesmith

InstallAware

Home of The Next Generation MSI Installer

Get your free copy today - http://www.installaware.com/

MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Postby MichaelNesmith » Sat Mar 25, 2006 8:12 pm

An immediate resolution is available for this problem which does not require an update.

If the double-backslash occurs at the start of the string (very first character), do nothing. Double backslashes at the start of a string are accepted.

If the double-backslash occurs anywhere else, use the "magic" sequence of seven backslashes to produce a double-backslash at runtime.
Michael Nesmith

InstallAware

Home of The Next Generation MSI Installer

Get your free copy today - http://www.installaware.com/

MikeFieger
Posts: 52
Joined: Thu Jan 26, 2006 9:09 am

Postby MikeFieger » Mon Mar 27, 2006 4:51 am

Tank you!

The "magic sequence" solved my problem :)


Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 154 guests