fix: Properly create parents directories.

pull/26/head
Raphaël Vinot 2020-01-15 17:22:56 +01:00
parent 9f74587cc1
commit 6b8ba32ccd
1 changed files with 2 additions and 2 deletions

View File

@ -187,7 +187,7 @@ class FileBase(object):
src = self.src_path src = self.src_path
dst = self.dst_path dst = self.dst_path
try: try:
self.dst_dir.mkdir(exist_ok=True) self.dst_dir.mkdir(exist_ok=True, parents=True)
shutil.copy(str(src), str(dst)) shutil.copy(str(src), str(dst))
current_perms = self._get_file_permissions(dst) current_perms = self._get_file_permissions(dst)
only_exec_bits = 0o0111 only_exec_bits = 0o0111
@ -217,7 +217,7 @@ class FileBase(object):
if Path(f'{self.src_path}{ext}').exists(): if Path(f'{self.src_path}{ext}').exists():
raise KittenGroomerError(f'Could not create metadata file for "{self.filename}": a file with that path exists.') raise KittenGroomerError(f'Could not create metadata file for "{self.filename}": a file with that path exists.')
else: else:
self.dst_dir.mkdir(exist_ok=True) self.dst_dir.mkdir(exist_ok=True, parents=True)
# TODO: shouldn't mutate state and also return something # TODO: shouldn't mutate state and also return something
self.metadata_file_path = Path(f'{self.dst_path}{ext}') self.metadata_file_path = Path(f'{self.dst_path}{ext}')
return self.metadata_file_path return self.metadata_file_path