Further fixes to scripts

This commit is contained in:
minexew committed 2017-01-22 21:10:54 +01:00
1 parent ef09ef818b
commit 31a6f9b5bf
2 files changed
+21 -19

No files matched your search

+18 -16
View File
@@ -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)