summaryrefslogtreecommitdiffstats
path: root/Mac/scripts/FixCreator.py
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>1996-02-21 15:27:24 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>1996-02-21 15:27:24 (GMT)
commit22586993c5471e6ed09a7a34807acf33dee59ebf (patch)
tree2a5cc7687e42f7640c9fecb0b4aabaa25556ef48 /Mac/scripts/FixCreator.py
parent23b8841d74bbeae2eaf5e5c20c207d7aac2aa3ef (diff)
downloadcpython-22586993c5471e6ed09a7a34807acf33dee59ebf.zip
cpython-22586993c5471e6ed09a7a34807acf33dee59ebf.tar.gz
cpython-22586993c5471e6ed09a7a34807acf33dee59ebf.tar.bz2
Script to recursively change PYTH creators to Pyth
Diffstat (limited to 'Mac/scripts/FixCreator.py')
-rw-r--r--Mac/scripts/FixCreator.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/Mac/scripts/FixCreator.py b/Mac/scripts/FixCreator.py
new file mode 100644
index 0000000..f5213d0
--- /dev/null
+++ b/Mac/scripts/FixCreator.py
@@ -0,0 +1,34 @@
+#
+# FixCreator - Search for files with PYTH creator
+# and set it to Pyth.
+#
+import os
+import macfs
+import sys
+
+OLD='PYTH'
+NEW='Pyth'
+
+def walktree(name, change):
+ if os.path.isfile(name):
+ fs = macfs.FSSpec(name)
+ cur_cr, cur_tp = fs.GetCreatorType()
+ if cur_cr == OLD:
+ fs.SetCreatorType(NEW, cur_tp)
+ print 'Fixed ', name
+ elif os.path.isdir(name):
+ print '->', name
+ files = os.listdir(name)
+ for f in files:
+ walktree(os.path.join(name, f), change)
+
+def run(change):
+ fss, ok = macfs.GetDirectory('Folder to search:')
+ if not ok:
+ sys.exit(0)
+ walktree(fss.as_pathname(), change)
+
+if __name__ == '__main__':
+ run(1)
+
+