diff options
Diffstat (limited to 'grc/compiler.py')
-rwxr-xr-x | grc/compiler.py | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/grc/compiler.py b/grc/compiler.py index 3f2bd98b07..2478055daf 100755 --- a/grc/compiler.py +++ b/grc/compiler.py @@ -42,13 +42,12 @@ def main(args=None): ) platform.build_library() - out_dir = args.output if not args.user_lib_dir else platform.config.hier_block_lib_dir - if os.path.exists(out_dir): - pass # all is well - elif args.save_to_lib: - os.mkdir(out_dir) # create missing hier_block lib directory - else: - exit('Error: Invalid output directory') + output_dir = args.output if not args.user_lib_dir else platform.config.hier_block_lib_dir + try: + # recursive mkdir: os.makedirs doesn't work with .. paths, resolve with realpath + os.makedirs(os.path.realpath(output_dir), exist_ok=True) + except Exception as e: + exit(str(e)) Messages.send_init(platform) flow_graph = file_path = None @@ -57,7 +56,7 @@ def main(args=None): Messages.send('\n') flow_graph, file_path = platform.load_and_generate_flow_graph( - os.path.abspath(grc_file), os.path.abspath(out_dir)) + os.path.abspath(grc_file), os.path.abspath(output_dir)) if not file_path: exit('Compilation error') if file_path and args.run: |