Skip to content

Commit 5ac14e3

Browse files
author
jackjansen
committed
Got rid of macfs and made a bit more OSX-friendly.
git-svn-id: http://svn.python.org/projects/python/trunk@31240 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent 227005b commit 5ac14e3

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

Mac/scripts/findgremlins.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
By Just, with a little glue by Jack"""
66

77
import EasyDialogs
8-
import macfs
8+
import MacOS
99
import re
1010
import os
1111
import string
@@ -20,8 +20,8 @@ def walk(top, recurse=1):
2020
path = os.path.join(top, name)
2121
walk(path)
2222
else:
23-
cr, tp = macfs.FSSpec(top).GetCreatorType()
24-
if tp == 'TEXT' and top[-4:] <> ".hqx":
23+
cr, tp = MacOS.GetCreatorAndType(top)
24+
if tp in ('TEXT', '\0\0\0\0') and top[-4:] <> ".hqx":
2525
data = open(top).read()
2626
badcount = 0
2727
for ch in data[:256]:
@@ -44,11 +44,14 @@ def walk(top, recurse=1):
4444
pos = j
4545

4646
def main():
47-
pathname = EasyDialogs.AskFolder()
48-
if pathname:
49-
walk(pathname)
47+
if sys.argv[1:]:
48+
for pathname in sys.argv[1:]:
49+
walk(pathname)
50+
else:
51+
pathname = EasyDialogs.AskFolder()
52+
if pathname:
53+
walk(pathname)
5054

5155
if __name__ == '__main__':
5256
main()
53-
sys.exit(1) # So we see the output
5457

0 commit comments

Comments
 (0)