Destination directories now get created when needed
This commit is contained in:
parent
310ac3784e
commit
2660af23d8
3 changed files with 8 additions and 19 deletions
|
|
@ -45,10 +45,13 @@ class Spec:
|
|||
destination if type(destination) == Path else Path(destination)
|
||||
)
|
||||
|
||||
# Check existence of destination folder
|
||||
if not self.destination.exists() or not self.destination.is_dir():
|
||||
# Create destination if non-existent
|
||||
try:
|
||||
self.destination.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
except FileExistsError:
|
||||
raise NotADirectoryError(
|
||||
"{} doesn't exist or isn't a directory.".format(
|
||||
"{} already exists, but isn't a directory.".format(
|
||||
self.destination
|
||||
)
|
||||
)
|
||||
|
|
|
|||
Reference in a new issue