Throw error if can't make temp directory

This commit is contained in:
Eren Dogan 2023-05-04 20:27:59 -07:00
parent a65a06e635
commit 420ce01b46
1 changed files with 10 additions and 8 deletions

View File

@ -475,18 +475,20 @@ def find_exe(check_exe):
def init_paths(): def init_paths():
""" Create the temp and output directory if it doesn't exist """ """ Create the temp and output directory if it doesn't exist. """
if os.path.exists(OPTS.openram_temp): if os.path.exists(OPTS.openram_temp):
purge_temp() purge_temp()
else: else:
# make the directory if it doesn't exist # Make the directory if it doesn't exist
try: try:
debug.info(1, debug.info(1, "Creating temp directory: {}".format(OPTS.openram_temp))
"Creating temp directory: {}".format(OPTS.openram_temp))
os.makedirs(OPTS.openram_temp, 0o750) os.makedirs(OPTS.openram_temp, 0o750)
except OSError as e: except OSError as e:
if e.errno == 17: # errno.EEXIST if e.errno == 17: # errno.EEXIST
os.chmod(OPTS.openram_temp, 0o750) os.chmod(OPTS.openram_temp, 0o750)
else:
debug.error("Unable to make temp directory: {}".format(OPTS.openram_temp), -1)
#import inspect #import inspect
#s = inspect.stack() #s = inspect.stack()
#from pprint import pprint #from pprint import pprint
@ -499,10 +501,10 @@ def init_paths():
try: try:
os.makedirs(OPTS.output_path, 0o750) os.makedirs(OPTS.output_path, 0o750)
except OSError as e: except OSError as e:
if e.errno == 17: # errno.EEXIST if e.errno == 17: # errno.EEXIST
os.chmod(OPTS.output_path, 0o750) os.chmod(OPTS.output_path, 0o750)
except: else:
debug.error("Unable to make output directory.", -1) debug.error("Unable to make output directory: {}".format(OPTS.output_path), -1)
def set_default_corner(): def set_default_corner():