|
9 | 9 | import subprocess |
10 | 10 | import sys |
11 | 11 |
|
| 12 | +def dir_path(string): |
| 13 | + if os.path.isdir(string): |
| 14 | + return string |
| 15 | + else: |
| 16 | + raise NotADirectoryError(string) |
| 17 | + |
12 | 18 | cmdline_desc = """\ |
13 | 19 | Runs Stone to generate Obj-C types and client for the Dropbox client. |
14 | 20 | """ |
|
53 | 59 | ) |
54 | 60 | _cmdline_parser.add_argument( |
55 | 61 | '-fs', |
56 | | - '--format-script-dir', |
57 | | - type=str, |
| 62 | + '--format-script-path', |
| 63 | + type=dir_path, |
58 | 64 | help='Path to format script directory.', |
59 | 65 | ) |
60 | 66 | _cmdline_parser.add_argument( |
@@ -94,7 +100,7 @@ def main(): |
94 | 100 | os.path.abspath('Source/ObjectiveDropboxOfficial/Shared/Generated') |
95 | 101 | dropbox_pkg_path = args.output_path if args.output_path else dropbox_default_output_path |
96 | 102 |
|
97 | | - dropbox_format_script_dir = args.format_script_dir if args.format_script_dir else \ |
| 103 | + dropbox_format_script_path = args.format_script_path if args.format_script_path else \ |
98 | 104 | os.path.abspath('Format') |
99 | 105 |
|
100 | 106 | dropbox_format_output_path = args.format_output_path if args.format_output_path else dropbox_src_path |
@@ -166,7 +172,7 @@ def main(): |
166 | 172 | print('Formatting source files') |
167 | 173 |
|
168 | 174 | cmd = ['./format_files.sh', dropbox_format_output_path] |
169 | | - o = subprocess.check_output(cmd, cwd=dropbox_format_script_dir) |
| 175 | + o = subprocess.check_output(cmd, cwd=dropbox_format_script_path) |
170 | 176 | if o: |
171 | 177 | print('Output:', o) |
172 | 178 |
|
|
0 commit comments