Skip to content

Commit

Permalink
(archives) better class member & method names
Browse files Browse the repository at this point in the history
  • Loading branch information
snake-biscuits committed Aug 13, 2024
1 parent c791c65 commit d3798a3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions bsp_tool/archives/cdrom.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class Directory:
ear_length: int
data_lba: int # LBA of data extent
data_size: int # size of data extent (in bytes)
recorded: TimeStamp
timestamp: TimeStamp
flags: FileFlag
interleaved_unit_size: int # "file unit size"; 0 if not interleaved
interleaved_gap_size: int # 0 if not interleaved
Expand All @@ -159,7 +159,7 @@ def from_stream(cls, stream: io.BytesIO) -> Directory:
# NOTE: ear is short for "Extended Attribute Record"
out.data_lba = read_both_endian(stream, "I")
out.data_size = read_both_endian(stream, "I")
out.recorded = TimeStamp.from_stream_bytes(stream)
out.timestamp = TimeStamp.from_stream_bytes(stream)
out.flags = FileFlag(binary.read_struct(stream, "B"))
out.interleaved_unit_size = binary.read_struct(stream, "B")
out.interleaved_gap_size = binary.read_struct(stream, "B")
Expand Down
4 changes: 2 additions & 2 deletions bsp_tool/archives/sega.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def full_path(self, path_table_index: int) -> str:
names.append(path.name)
return "/" + "/".join(reversed(names)) + "/"

def folder_contents(self, path_index: int) -> List[cdrom.Directory]:
def path_records(self, path_index: int) -> List[cdrom.Directory]:
path = self.path_table[path_index]
lba = path.extent_lba - self.data_area_lba
self.data_area.seek(lba * self.pvd.block_size)
Expand All @@ -108,7 +108,7 @@ def listdir(self, search_folder: str) -> List[str]:
folders = [self.full_path(i) for i, path in enumerate(self.path_table)]
assert search_folder in folders, "path not found"
path_index = folders.index(search_folder)
records = self.folder_contents(path_index)
records = self.path_records(path_index)
assert records[0].name == "."
assert records[1].name == ".."
# NOTE: we could add a "/" to the end of a name if it's not a file
Expand Down

0 comments on commit d3798a3

Please sign in to comment.