diff --git a/generate_base_client.py b/generate_base_client.py index 52e98a9bb..decdc8d3c 100755 --- a/generate_base_client.py +++ b/generate_base_client.py @@ -9,6 +9,12 @@ import subprocess import sys +def dir_path(string): + if os.path.isdir(string): + return string + else: + raise NotADirectoryError(string) + cmdline_desc = """\ Runs Stone to generate Obj-C types and client for the Dropbox client. """ @@ -53,8 +59,8 @@ ) _cmdline_parser.add_argument( '-fs', - '--format-script-dir', - type=str, + '--format-script-path', + type=dir_path, help='Path to format script directory.', ) _cmdline_parser.add_argument( @@ -94,7 +100,7 @@ def main(): os.path.abspath('Source/ObjectiveDropboxOfficial/Shared/Generated') dropbox_pkg_path = args.output_path if args.output_path else dropbox_default_output_path - dropbox_format_script_dir = args.format_script_dir if args.format_script_dir else \ + dropbox_format_script_path = args.format_script_path if args.format_script_path else \ os.path.abspath('Format') dropbox_format_output_path = args.format_output_path if args.format_output_path else dropbox_src_path @@ -166,7 +172,7 @@ def main(): print('Formatting source files') cmd = ['./format_files.sh', dropbox_format_output_path] - o = subprocess.check_output(cmd, cwd=dropbox_format_script_dir) + o = subprocess.check_output(cmd, cwd=dropbox_format_script_path) if o: print('Output:', o)