mirror of
https://github.com/PyCQA/flake8.git
synced 2026-03-29 10:36:53 +00:00
Ensure that the directories exist
If we create our temporary directory structure for our files, we need to ensure that all the directories (including the ones in the filename) exist before we copy the contents to that location.
This commit is contained in:
parent
27eb975411
commit
07101231d9
1 changed files with 2 additions and 0 deletions
|
|
@ -116,6 +116,8 @@ def copy_file_to(destination_directory, filepath, contents):
|
|||
directory, filename = os.path.split(os.path.abspath(filepath))
|
||||
temporary_directory = make_temporary_directory_from(destination_directory,
|
||||
directory)
|
||||
if not os.path.exists(temporary_directory):
|
||||
os.makedirs(temporary_directory)
|
||||
temporary_filepath = os.path.join(temporary_directory, filename)
|
||||
with open(temporary_filepath, 'wb') as fd:
|
||||
fd.write(contents)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue