#!/usr/bin/env python # # CiderPress extracts some files with 0x80 OR'd into some bytes. Stripping # out this bit, makes the file "correct" (in terms of looking correct and # with respect to how Apple DOS FS extracts the file) # # This script is a little helper to examine/validate that problem and that # the files are otherwise correct. # # Surprisingly: CP depends upon nufxlib, which appears to properly unshrink # a .SHK file for ADFS to read. Yet CP cannot properly consume the expanded # form, and CP when used against the shrunk version, it produces this 0x80 # weirdness for some files. # import sys def load8(path): contents = open(path).read() return [ord(c) & 0x7f for c in contents] def cmp8(path1, path2): f1 = load8(path1) f2 = load8(path2) print '%s: len=%d' % (path1, len(f1)) print '%s: len=%d' % (path2, len(f2)) if f1 == f2: print 'Compare: equal' else: print 'Compare: different' if __name__ == '__main__': cmp8(sys.argv[1], sys.argv[2])