Skip to content

Commit

Permalink
--overwrite bug fix on mkdir logic.
Browse files Browse the repository at this point in the history
  • Loading branch information
aeoranday committed Feb 14, 2024
1 parent 706bb80 commit 1031b64
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion apps/ta_dump.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,9 @@ def main():
plot_iter += 1
plot_dir = f"{data.run_id}-{data.file_index}_figures_{plot_iter:04}"
print(f"Saving outputs to ./{plot_dir}/")
if not overwrite: # Can only create new dirs.
# If overwriting and it does exist, don't need to make it.
# So take the inverse to mkdir.
if not (overwrite and os.path.isdir(plot_dir)):
os.mkdir(plot_dir)
os.chdir(plot_dir)

Expand Down
4 changes: 3 additions & 1 deletion apps/tp_dump.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,9 @@ def main():
plot_iter += 1
plot_dir = f"{data.run_id}-{data.file_index}_figures_{plot_iter:04}"
print(f"Saving outputs to ./{plot_dir}/")
if not overwrite: # Can only create new dirs.
# If overwriting and it does exist, don't need to make it.
# So take the inverse to mkdir.
if not (overwrite and os.path.isdir(plot_dir)):
os.mkdir(plot_dir)
os.chdir(plot_dir)

Expand Down

0 comments on commit 1031b64

Please sign in to comment.