aboutsummaryrefslogtreecommitdiff
path: root/ninjabackend.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2016-01-02 19:14:13 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2016-01-02 19:14:13 +0200
commitf1bf87ec8a765801b8aec97d64e97b578817430b (patch)
tree32ec12c83addd0d25a66c19e538fcda9fdece947 /ninjabackend.py
parentea9b49438df496003291287f0028062c195df502 (diff)
downloadmeson-f1bf87ec8a765801b8aec97d64e97b578817430b.zip
meson-f1bf87ec8a765801b8aec97d64e97b578817430b.tar.gz
meson-f1bf87ec8a765801b8aec97d64e97b578817430b.tar.bz2
Added test to check that backslashes are passed properly through the pipeline.
Diffstat (limited to 'ninjabackend.py')
-rw-r--r--ninjabackend.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/ninjabackend.py b/ninjabackend.py
index 1ef2642..8eef148 100644
--- a/ninjabackend.py
+++ b/ninjabackend.py
@@ -86,11 +86,10 @@ class NinjaBuildElement():
if len(self.orderdeps) > 0:
line += ' || ' + ' '.join([ninja_quote(x) for x in self.orderdeps])
line += '\n'
- # This needs to be done to make these strings
- # pass through arbitrary shells. Backslash is a
- # quote character so it can break at any time.
- # Because of this always use forward slashes,
- # it is a path separator even on Windows.
+ # This is the only way I could find to make this work on all
+ # platforms including Windows command shell. Slash is a dir separator
+ # on Windows, too, so all characters are unambiguous and, more importantly,
+ # do not require quoting.
line = line.replace('\\', '/')
outfile.write(line)
@@ -111,7 +110,7 @@ class NinjaBuildElement():
newelems.append(templ % ninja_quote(i))
line += ' '.join(newelems)
line += '\n'
- line = line.replace('\\', '/')
+ line = line.replace('\\', '\\\\')
outfile.write(line)
outfile.write('\n')