Skip to content

Commit

Permalink
fix error in file tree error and specific utf16 endianness in TXT
Browse files Browse the repository at this point in the history
  • Loading branch information
duncathan committed Jan 29, 2022
1 parent 30fd3c4 commit c62d153
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion mercury_engine_data_structures/file_tree_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,9 @@ def save_modified_pkgs(self, output_path: Optional[Path] = None):
if None in self._files_for_asset_id[asset_id]:
path = self._name_for_asset_id[asset_id]
logger.info("Writing to %s with %d bytes", path, len(data))
output_path.joinpath(path).write_bytes(data)
target_path = output_path.joinpath(path)
target_path.parent.mkdir(parents=True, exist_ok=True)
target_path.write_bytes(data)
else:
self._toc.remove_file(asset_id)

Expand Down
2 changes: 1 addition & 1 deletion mercury_engine_data_structures/formats/txt.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
TXT = Struct(
"magic" / Const(b'BTXT'),
"version" / Const(b'\x01\x00\x0a\x00'),
"strings" / DictAdapter(GreedyRange(DictElement(CStringRobust("utf16"))))
"strings" / DictAdapter(GreedyRange(DictElement(CStringRobust("utf-16-le"))))
)

class Txt(BaseResource):
Expand Down

0 comments on commit c62d153

Please sign in to comment.