Kaydet (Commit) f3f4af55 authored tarafından Jack Jansen's avatar Jack Jansen

Got rid of macfs and made a bit more OSX-friendly.

üst 19e02fc6
...@@ -5,7 +5,7 @@ the filename and a bit of context. ...@@ -5,7 +5,7 @@ the filename and a bit of context.
By Just, with a little glue by Jack""" By Just, with a little glue by Jack"""
import EasyDialogs import EasyDialogs
import macfs import MacOS
import re import re
import os import os
import string import string
...@@ -20,8 +20,8 @@ def walk(top, recurse=1): ...@@ -20,8 +20,8 @@ def walk(top, recurse=1):
path = os.path.join(top, name) path = os.path.join(top, name)
walk(path) walk(path)
else: else:
cr, tp = macfs.FSSpec(top).GetCreatorType() cr, tp = MacOS.GetCreatorAndType(top)
if tp == 'TEXT' and top[-4:] <> ".hqx": if tp in ('TEXT', '\0\0\0\0') and top[-4:] <> ".hqx":
data = open(top).read() data = open(top).read()
badcount = 0 badcount = 0
for ch in data[:256]: for ch in data[:256]:
...@@ -44,11 +44,14 @@ def walk(top, recurse=1): ...@@ -44,11 +44,14 @@ def walk(top, recurse=1):
pos = j pos = j
def main(): def main():
pathname = EasyDialogs.AskFolder() if sys.argv[1:]:
if pathname: for pathname in sys.argv[1:]:
walk(pathname) walk(pathname)
else:
pathname = EasyDialogs.AskFolder()
if pathname:
walk(pathname)
if __name__ == '__main__': if __name__ == '__main__':
main() main()
sys.exit(1) # So we see the output
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment