Skip to content

Commit

Permalink
Change resource table code
Browse files Browse the repository at this point in the history
  • Loading branch information
Schamper committed Mar 18, 2024
1 parent dfd732f commit abad82e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions dissect/archive/wim.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,10 @@ def _read_resource_table(self) -> tuple[dict[bytes, Resource], list[Resource]]:

return table, images

def resources(self) -> Iterator[Resource]:
"""Iterate over all resources in the WIM file."""
yield from self._resource_table.values()
@property
def resources(self) -> dict[bytes, Resource]:
"""Return the table of resources in the WIM file."""
return self._resource_table

def images(self) -> Iterator[Image]:
"""Iterate over all images in the WIM file."""
Expand Down Expand Up @@ -364,7 +365,7 @@ def open(self, name: str = "") -> BinaryIO:
if stream_hash.strip(b"\x00") == b"":
return BufferedStream(io.BytesIO(b""), size=0)

if resource := self.image.wim._resource_table.get(stream_hash):
if resource := self.image.wim.resources.get(stream_hash):
return resource.open()
else:
raise FileNotFoundError(f"Unable to find resource for directory entry {self}")
Expand Down

0 comments on commit abad82e

Please sign in to comment.