Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create directory structure when writing files #244

Merged
merged 4 commits into from
Oct 6, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Create directory structure when writing files
  • Loading branch information
agyoungs committed Sep 25, 2023
commit 928cb8ad88599d0e92593c1ed15e7cf770806c7f
2 changes: 2 additions & 0 deletions src/rocker/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import pexpect

import fcntl
import pathlib
import signal
import struct
import termios
Expand Down Expand Up @@ -330,6 +331,7 @@ def write_files(extensions, args_dict, target_directory):
'and cannot be written out, skipping' % (file_name, active_extension.get_name()))
continue
full_path = os.path.join(target_directory, file_name)
pathlib.Path(os.path.dirname(full_path)).mkdir(exist_ok=True, parents=True)
with open(full_path, 'w') as fh:
print('Writing to file %s' % full_path)
fh.write(contents)
Expand Down