When normalizing, OEBPS exist_ok=True.

I hadn't considered that the content.opf would be in the root when
there is an OEBPS dir present. There's a whole weird world out there.
This commit is contained in:
Ethan Dalool 2019-08-06 23:38:56 -07:00
parent 29eea3855c
commit 0364b87cf3

View file

@ -834,7 +834,7 @@ class Epub:
if self.opf_filepath.parent == self.root_directory: if self.opf_filepath.parent == self.root_directory:
oebps = self.root_directory.with_child('OEBPS') oebps = self.root_directory.with_child('OEBPS')
os.makedirs(oebps.absolute_path) os.makedirs(oebps.absolute_path, exist_ok=True)
self.write_opf() self.write_opf()
new_opf_path = oebps.with_child(self.opf_filepath.basename) new_opf_path = oebps.with_child(self.opf_filepath.basename)
os.rename(self.opf_filepath.absolute_path, new_opf_path.absolute_path) os.rename(self.opf_filepath.absolute_path, new_opf_path.absolute_path)