From 5a5b9ff8e62c00e0df63ce41e209f8c76a3f6a2f Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Mon, 15 Jan 2024 13:29:33 -0500 Subject: [PATCH] Fix #329. --- korman/exporter/outfile.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/korman/exporter/outfile.py b/korman/exporter/outfile.py index 2b5bfdf..4440259 100644 --- a/korman/exporter/outfile.py +++ b/korman/exporter/outfile.py @@ -382,15 +382,16 @@ class OutputFiles: for i in self._generate_files(func): # Will only ever run for non-"dat" directories. - dst_path = str(self._export_path / i.dirname / i.filename) + dst_path = self._export_path.joinpath(i.dirname, i.filename) + dst_path.parent.mkdir(parents=True, exist_ok=True) if i.file_data: mode = "w" if isinstance(i.file_data, str) else "wb" - with open(dst_path, mode) as handle: + with dst_path.open(mode) as handle: handle.write(i.file_data) os.utime(dst_path, times) elif i.file_path: if i.file_path != dst_path: - shutil.copy2(i.file_path, dst_path) + shutil.copy2(i.file_path, str(dst_path)) else: report.warn("No data found for dependency file '{}'. It will not be copied into the export directory.", PurePath(i.dirname, i.filename))