diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 2003-02-05 23:10:46 (GMT) |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 2003-02-05 23:10:46 (GMT) |
commit | f3f4af55214370e5c6df928e8c8242d14060e204 (patch) | |
tree | c9c927fa5153deb6db2a97ab3307fef525d65240 /Mac/scripts | |
parent | 19e02fc67f5788ab2a3d6c3fe1ec3b5e440660af (diff) | |
download | cpython-f3f4af55214370e5c6df928e8c8242d14060e204.zip cpython-f3f4af55214370e5c6df928e8c8242d14060e204.tar.gz cpython-f3f4af55214370e5c6df928e8c8242d14060e204.tar.bz2 |
Got rid of macfs and made a bit more OSX-friendly.
Diffstat (limited to 'Mac/scripts')
-rw-r--r-- | Mac/scripts/findgremlins.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/Mac/scripts/findgremlins.py b/Mac/scripts/findgremlins.py index 595551e..3569c77 100644 --- a/Mac/scripts/findgremlins.py +++ b/Mac/scripts/findgremlins.py @@ -5,7 +5,7 @@ the filename and a bit of context. By Just, with a little glue by Jack""" import EasyDialogs -import macfs +import MacOS import re import os import string @@ -20,8 +20,8 @@ def walk(top, recurse=1): path = os.path.join(top, name) walk(path) else: - cr, tp = macfs.FSSpec(top).GetCreatorType() - if tp == 'TEXT' and top[-4:] <> ".hqx": + cr, tp = MacOS.GetCreatorAndType(top) + if tp in ('TEXT', '\0\0\0\0') and top[-4:] <> ".hqx": data = open(top).read() badcount = 0 for ch in data[:256]: @@ -44,11 +44,14 @@ def walk(top, recurse=1): pos = j def main(): - pathname = EasyDialogs.AskFolder() - if pathname: - walk(pathname) + if sys.argv[1:]: + for pathname in sys.argv[1:]: + walk(pathname) + else: + pathname = EasyDialogs.AskFolder() + if pathname: + walk(pathname) if __name__ == '__main__': main() - sys.exit(1) # So we see the output |