Index: build/copy_test_data_ios.py |
diff --git a/build/copy_test_data_ios.py b/build/copy_test_data_ios.py |
index d785f2675854c69f0a1d77cf7d347f7c6b2e9c40..6f0302f9506e0471aeaec7852af12dcddc30f0a9 100755 |
--- a/build/copy_test_data_ios.py |
+++ b/build/copy_test_data_ios.py |
@@ -13,6 +13,10 @@ import sys |
class WrongNumberOfArgumentsException(Exception): |
pass |
+def EscapePath(path): |
+ """Returns a path with spaces escaped.""" |
+ return path.replace(" ", "\\ ") |
+ |
def ListFilesForPath(path): |
"""Returns a list of all the files under a given path.""" |
output = [] |
@@ -36,13 +40,10 @@ def ListFilesForPath(path): |
def CalcInputs(inputs): |
"""Computes the full list of input files for a set of command-line arguments. |
""" |
- # |inputs| is a list of strings, each of which may contain muliple paths |
- # separated by spaces. |
+ # |inputs| is a list of paths, which may be directories. |
output = [] |
for input in inputs: |
- tokens = input.split() |
- for token in tokens: |
- output.extend(ListFilesForPath(token)) |
+ output.extend(ListFilesForPath(input)) |
return output |
def CopyFiles(relative_filenames, output_basedir): |
@@ -76,14 +77,15 @@ def DoMain(argv): |
raise WrongNumberOfArgumentsException('<input_files> required.') |
files_to_copy = CalcInputs(arglist) |
+ escaped_files = [EscapePath(x) for x in CalcInputs(arglist)] |
if options.list_inputs: |
- return '\n'.join(files_to_copy) |
+ return '\n'.join(escaped_files) |
if not options.output_dir: |
raise WrongNumberOfArgumentsException('-o required.') |
if options.list_outputs: |
- outputs = [os.path.join(options.output_dir, x) for x in files_to_copy] |
+ outputs = [os.path.join(options.output_dir, x) for x in escaped_files] |
return '\n'.join(outputs) |
CopyFiles(files_to_copy, options.output_dir) |