Modified for CW Pro 1 projects. Convention used: .mu files are old
project files, which have to be cleaned up before checking in, .prj
files are CW Pro 1 projects (which are always clean). Prj files are
still binhexed, even though they only have a data fork (and, hence,
could be checked in in binary mode).
diff --git a/Mac/scripts/binhextree.py b/Mac/scripts/binhextree.py
index b354e4a..f5ebc8e 100644
--- a/Mac/scripts/binhextree.py
+++ b/Mac/scripts/binhextree.py
@@ -24,7 +24,7 @@
 # Where to put CW projects, relative to TOP
 CWDIR=':Mac:mwerks:projects'
 # From which folders to put projects there
-CWDIRDIRS=['build.macppc.stand', 'build.macppc.shared', 'build.mac68k.stand', 'build.mac68k.shared', 'PlugIns']
+CWDIRDIRS=['build.mac', 'build.macstand', 'PlugIns']
 
 # Helper routines
 def binhexit(path, name):
@@ -72,16 +72,14 @@
 
 def hexbincwprojects(creator):
 	"""Compact and hexbin all files remembered with a given creator"""
-	try:
-		mgr = MwShell(creator, start=1)
-	except 'foo':
-		print 'Not handled:', creator
-		return
+	cw_running = 0
 	for fss in project_files[creator]:
 		srcfile = fss.as_pathname()
 		
+		old_style = 0
 		if srcfile[-1] == 'µ':
 			dstfile = srcfile[:-1]+'mu.hqx'
+			old_style = 1
 		elif srcfile[-3] == '.mu':
 			dstfile = srcfile + '.hqx'
 		elif ord(srcfile[-1]) >= 128:
@@ -94,14 +92,23 @@
 			print 'Skip', dstfile,'- Up-to-date'
 			continue
 		print 'Compacting', dstfile
-		mgr.open(fss)
-		mgr.Reset_File_Paths()
-		mgr.Remove_Binaries()
-		mgr.Close_Project()
+		if old_style:
+			if not cw_running:
+				try:
+					mgr = MwShell(creator, start=1)
+				except 'foo':
+					print 'Not handled:', creator
+					return
+				cw_running = 1
+			mgr.open(fss)
+			mgr.Reset_File_Paths()
+			mgr.Remove_Binaries()
+			mgr.Close_Project()
 		
 		print 'Binhexing', dstfile
 		binhex.binhex(srcfile, dstfile)
-	mgr.quit()
+	if cw_running:
+		mgr.quit()
 	
 def copycwproject(path, name):
 	"""Copy CW project (if needed) and remember for hexbinning"""
@@ -119,19 +126,25 @@
 			return
 		dstfile = os.path.join(dstdir, os.path.join(srcdir, name))
 	else:
-		if path[-2:] != '.µ':
+		if path[-2:] == '.µ':
+			dstfile = path[:-2]+ '.mu'
+		elif path[-4:] == '.prj':
+			dstfile = None
+		else:
 			return
-		dstfile = path[:-2]+ '.mu'
 
-	# If the destination doesn't exists or is older that the source
-	# we copy and remember it
-	
-	if os.path.exists(dstfile) and \
-			os.stat(dstfile)[8] >= os.stat(path)[8]:
-		print 'Not copying', path,'- Up-to-date'
+	if dstfile:
+		# If the destination doesn't exists or is older that the source
+		# we copy and remember it
+		
+		if os.path.exists(dstfile) and \
+				os.stat(dstfile)[8] >= os.stat(path)[8]:
+			print 'Not copying', path,'- Up-to-date'
+		else:
+			print 'Copy', path
+			macostools.copy(path, dstfile)
 	else:
-		print 'Copy', path
-		macostools.copy(path, dstfile)
+		dstfile = path
 	
 	fss = macfs.FSSpec(dstfile)
 	creator = fss.GetCreatorType()[0]
@@ -177,6 +190,8 @@
 	('.rsrc', binhexit),
 	('.gif', binhexit),
 	('.µ', copycwproject),
+	('.prj', copycwproject),
+	('.prj.exp', copycwexpfile),
 	('.µ.exp', copycwexpfile)
 	]