Skip to content

Commit

Permalink
comic: Allow filename to be a path
Browse files Browse the repository at this point in the history
If the filename is a path we need to ensure all its components exist to
avoid errors later when we try to create the file at that path.
  • Loading branch information
toonn committed Dec 7, 2023
1 parent 44d1a1e commit de2c599
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions dosagelib/comic.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,10 @@ def _exist_err(self, fn):
def _fnbase(self, basepath):
'''Determine the target base name of this comic file and make sure the
directory exists.'''
comicdir = self.scraper.get_download_dir(basepath)
comicpath = os.path.join(
self.scraper.get_download_dir(basepath), self.filename
)
comicdir = os.path.dirname(comicpath)
if not os.path.isdir(comicdir):
os.makedirs(comicdir)
return os.path.join(comicdir, self.filename)
return comicpath

0 comments on commit de2c599

Please sign in to comment.