diff options
-rw-r--r-- | build/copy_test_data_ios.gypi | 2 | ||||
-rwxr-xr-x | build/copy_test_data_ios.py | 16 |
2 files changed, 10 insertions, 8 deletions
diff --git a/build/copy_test_data_ios.gypi b/build/copy_test_data_ios.gypi index 150df6e..56a222f 100644 --- a/build/copy_test_data_ios.gypi +++ b/build/copy_test_data_ios.gypi @@ -43,6 +43,6 @@ 'python', '<(DEPTH)/build/copy_test_data_ios.py', '-o', '<(PRODUCT_DIR)/<(_target_name).app/<(test_data_prefix)', - '<(_inputs)', + '<@(_inputs)', ], } diff --git a/build/copy_test_data_ios.py b/build/copy_test_data_ios.py index d785f26..6f0302f 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) |