Skip to content

Commit

Permalink
Throw error if can't make temp directory
Browse files Browse the repository at this point in the history
  • Loading branch information
erendn committed May 5, 2023
1 parent a65a06e commit 420ce01
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions compiler/globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,18 +475,20 @@ def find_exe(check_exe):


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):
purge_temp()
else:
# make the directory if it doesn't exist
# Make the directory if it doesn't exist
try:
debug.info(1,
"Creating temp directory: {}".format(OPTS.openram_temp))
debug.info(1, "Creating temp directory: {}".format(OPTS.openram_temp))
os.makedirs(OPTS.openram_temp, 0o750)
except OSError as e:
if e.errno == 17: # errno.EEXIST
if e.errno == 17: # errno.EEXIST
os.chmod(OPTS.openram_temp, 0o750)
else:
debug.error("Unable to make temp directory: {}".format(OPTS.openram_temp), -1)
#import inspect
#s = inspect.stack()
#from pprint import pprint
Expand All @@ -499,10 +501,10 @@ def init_paths():
try:
os.makedirs(OPTS.output_path, 0o750)
except OSError as e:
if e.errno == 17: # errno.EEXIST
if e.errno == 17: # errno.EEXIST
os.chmod(OPTS.output_path, 0o750)
except:
debug.error("Unable to make output directory.", -1)
else:
debug.error("Unable to make output directory: {}".format(OPTS.output_path), -1)


def set_default_corner():
Expand Down

0 comments on commit 420ce01

Please sign in to comment.