Skip to content

Commit 4e28436

Browse files
committed
Fix save method ignoring alternate dir
1 parent 8014129 commit 4e28436

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/altparse/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ def save(self, alternate_dir: Path | str | None = None, prettify: bool = True):
237237
alternate_dir (Path | str | None, optional): _description_. Defaults to None.
238238
"""
239239
full_src = self.src.to_dict()
240-
with open(self.src.path, "w", encoding="utf-8") as fp:
240+
with open(alternate_dir or self.src.path, "w", encoding="utf-8") as fp:
241241
json.dump(full_src, fp, indent = 2 if prettify else None)
242242
fp.write("\n") # add missing newline to EOF
243243

0 commit comments

Comments
 (0)