Double backslashes removed

Got a problem you cannot solve? Try here.
Post Reply
rasmusw
Posts: 44
Joined: Tue May 19, 2009 3:06 am

Double backslashes removed

Post by rasmusw »

Hello,
I understand that InstallAware replaces double backslashes with single ones \\ =>
Can I avoid this behavior?

I have a problem with the Run Program action which should run $TARGETDIR$\postinstaller.exe with command line parameters such as
/install="$TARGETDIR$\config.dll"

When $TARGETDIR$ contains a UNC path (starts with \\ ), the Run Program action can execute the file, but the $TARGETDIR$ variable in the command line parameters is changed, and thus the path in the command line parameters is invalid.
FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Double backslashes removed

Post by FrancescoT »

Dear Rasmusw,

just try to add an additional backslashes to your parameter argument, when the argument variable contains an UNC path (starts with \\ ).

Example;

Code: Select all

Set Variable MY_EXE_PATH to \\PC-NAME\path\myApp.exe
 
if Variable MY_EXE_PATH Contains \\PC-NAME
Set Variable MY_EXE_PATH to \$MY_EXE_PATH$
end
Run Program cmd.exe /k ECHO ON "$MY_EXE_PATH$" (WAIT)
The same as IA clipboard format;

Code: Select all

~InstallAware Clipboard Data~
~Run Program~
~{D3793EA0-A514-4AE5-B329-180F9E54F7A2}~
~cmd.exe~
~FALSE~
~/k ECHO ON "$MY_EXE_PATH$"~
~TRUE~
~~
~End~
~{95590036-9CA9-428E-808E-2E7F8144081A}~
~Set Variable~
~{3F228688-5115-4CB4-A082-70DF5CA2F588}~
~MY_EXE_PATH$MYAH$MYAH$FALSE~
~\$MY_EXE_PATH$~
~If~
~{15E38E3F-33D8-4828-982C-EC2A6126ABC2}~
~MY_EXE_PATH~
~1~
~\\PC-NAME~
~FALSE~
~Comment~
~{BACC8D4A-57A4-4005-8CA7-52DDDA0F8B79}~
~~
~Set Variable~
~{7EF7EB77-25F6-4F06-B8E6-EB8112684FFC}~
~MY_EXE_PATH$MYAH$MYAH$FALSE~
~\\PC-NAME\path\myApp.exe~
With the above code I used "cmd.exe /k ECHO ON", for the sole purpose to print out the effective argument value passed out by "Run Program".

Hope this helps you.

Regards.
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
rasmusw
Posts: 44
Joined: Tue May 19, 2009 3:06 am

Re: Double backslashes removed

Post by rasmusw »

Hello Francesco,
thank you for your suggestion, I will try it.

Best regards,
Rasmus
FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Double backslashes removed

Post by FrancescoT »

It should work ... I used the same with a project.

Regards
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
mihai
Posts: 37
Joined: Fri Nov 29, 2013 3:53 am

Re: Double backslashes removed

Post by mihai »

Has this been improved in the latest releases, e.g. X17, to turn off the behavior? It's a pain to anticipate this all over an installer and apply workarounds.

Also, the behavior is very annoying when the user tries to actually type double-backslashes.
JohnGaver
Posts: 265
Joined: Mon Feb 05, 2024 6:15 pm

Re: Double backslashes removed

Post by JohnGaver »

This topic applies to InstallAware Multi Platform as well.

Each programming language has its own escape sequence for particular characters, this is simply how it works for InstallAware.
John Gaver
InstallAware Skunkworks
InstallAware Multi Platform - Liberating DEB/RPM/PKG/MSI(X) into universal native setups!
Get your free copy today - https://www.installaware.com/installawa ... atform.htm
mihai
Posts: 37
Joined: Fri Nov 29, 2013 3:53 am

Re: Double backslashes removed

Post by mihai »

I'm not necessarily talking about the programming language, but the auto-replacement of the double-backslash in the edit box, as the user types in.

Can that actually be explained by the data flow as the user types, say back and forth from the UI into the variables, and thus the replacement happens?

In any case, you can imagine how annoying this can be for the end user, typing one thing and seeing another. At one point, the cursor even jumps back to the beginning of the string, and typing more backslashes doesn't do anything.
JohnGaver
Posts: 265
Joined: Mon Feb 05, 2024 6:15 pm

Re: Double backslashes removed

Post by JohnGaver »

Oh, most interesting!

Please provide a minimum reproducing project for further research and escalation.
John Gaver
InstallAware Skunkworks
InstallAware Multi Platform - Liberating DEB/RPM/PKG/MSI(X) into universal native setups!
Get your free copy today - https://www.installaware.com/installawa ... atform.htm
mihai
Posts: 37
Joined: Fri Nov 29, 2013 3:53 am

Re: Double backslashes removed

Post by mihai »

JohnGaver wrote:Please provide a minimum reproducing project for further research and escalation.
Simply create a new project in X17 and "bind" a user variable to an edit box using the "[Written variable value]" option. The other options there seem fine, like the “Installation Folder“, but are not appropriate for the task at hand.

I'm guessing that the behavior is intentional, but there's a need for a generic option that will allow any input, w/out parsing for escapes.
Post Reply