I need to escape spaces in the installdir variable when I substitute a value in a script on OS X.

From:
/Applications/My OS X Application

To:
/Applications/My\ OS\ X\ Application

I was expecting ${installdir.osx} to work like ${installdir.dos} or ${installdir.unix} but the variable doesn't exist. Is anyone aware of a way to accomplish this for OS X?

asked 06 Nov '11, 20:06

twism113's gravatar image

twism113
11223
accept rate: 0%


You could surround it by quotes when writing it into the script or use a regular expression:

<setInstallerVariableFromRegEx>
    <name>escaped_installdir</name>
    <pattern> </pattern>
    <substitution>\\ </substitution>
    <text>${installdir}</text>
</setInstallerVariableFromRegEx>

And use ${escaped_installdir} instead.

link

answered 07 Nov '11, 03:31

juanjo's gravatar image

juanjo ♦♦
5.8k413
accept rate: 23%

Worked great! Thanks!

(07 Nov '11, 11:39) twism113
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×88
×51
×41

Asked: 06 Nov '11, 20:06

Seen: 1,597 times

Last updated: 07 Nov '11, 11:39