diff --git a/extract_templeos.py b/extract_templeos.py index 1457b86..8caa6ac 100755 --- a/extract_templeos.py +++ b/extract_templeos.py @@ -1,10 +1,12 @@ #!/usr/bin/env python +import sys +sys.path.append('isoparser') + import errno import isoparser import os import subprocess -import sys ISO_FILE = sys.argv[1] OUTPUT_DIR = sys.argv[2] @@ -19,25 +21,25 @@ def make_sure_path_exists(path): raise def extract(node, path): - make_sure_path_exists(path) - for entry in node.children: - full_path = os.path.join(path, entry.name) + make_sure_path_exists(path) + for entry in node.children: + full_path = os.path.join(path, entry.name) - if entry.is_directory: - extract(entry, full_path) - else: - open(full_path, 'wb').write(entry.content) + if entry.is_directory: + extract(entry, full_path) + else: + open(full_path, 'wb').write(entry.content) def decompress_all_files_in(path): - for item in os.listdir(path): - full_path = os.path.join(path, item) + for item in os.listdir(path): + full_path = os.path.join(path, item) - if os.path.isdir(full_path): - decompress_all_files_in(full_path) - elif full_path.endswith('.Z'): - decompressed_path = full_path[0:len(full_path)-2] - subprocess.check_call(['./TOSZ', '-ascii', full_path, decompressed_path]) - os.remove(full_path) + if os.path.isdir(full_path): + decompress_all_files_in(full_path) + elif full_path.endswith('.Z'): + decompressed_path = full_path[0:len(full_path)-2] + subprocess.check_call(['./TOSZ', '-ascii', full_path, decompressed_path]) + os.remove(full_path) # Extract TempleOS disk tree extract(iso.root, OUTPUT_DIR) diff --git a/isoparser.patch b/isoparser.patch index 784e26c..1daf7d0 100644 --- a/isoparser.patch +++ b/isoparser.patch @@ -1,7 +1,7 @@ -diff --git a/isoparser/record.py b/isoparser/record.py +diff --git a/isoparser/isoparser/record.py b/isoparser/isoparser/record.py index 4cf19f3..a09160d 100644 ---- a/isoparser/record.py -+++ b/isoparser/record.py +--- a/isoparser/isoparser/record.py ++++ b/isoparser/isoparser/record.py @@ -47,7 +47,7 @@ class Record(object): self.embedded_susp_entries = susp_entries