-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlist_hfs_image.py
More file actions
33 lines (23 loc) · 783 Bytes
/
list_hfs_image.py
File metadata and controls
33 lines (23 loc) · 783 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import argparse
from machfs import Volume, Folder
import common
def main():
args = argparse.ArgumentParser()
args.add_argument('hfs_image', help='Disk image', type=str)
args = args.parse_args()
hfs_image: str = args.hfs_image
print(f'Checking if hfs image exists at {hfs_image} ...')
if common.file_exists(hfs_image):
common.ok()
else:
common.fail(f'{hfs_image} does not exist or is not a file')
hfs: Volume = common.read_image(hfs_image)
print(f'Listing folders on {hfs_image}')
for p, obj in hfs.iter_paths():
if type(obj) is Folder:
obj: Folder
image_hfs_folder = common.tuple_to_hfs_path(p)
print(image_hfs_folder)
common.ok()
if __name__ == '__main__':
main()