Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c42c0b7

Browse files
committed
Only copy project files from build* and plugins to the projects
folder, leave other projects where they are
1 parent d2034c1 commit c42c0b7

1 file changed

Lines changed: 33 additions & 17 deletions

File tree

Mac/scripts/binhextree.py

Lines changed: 33 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ class MwShell(aetools.TalkTo, Metrowerks_Shell_Suite, Required_Suite):
2323

2424
# Where to put CW projects, relative to TOP
2525
CWDIR=':Mac:mwerks:projects'
26+
# From which folders to put projects there
27+
CWDIRDIRS=['build.macppc.stand', 'build.macppc.shared', 'build.mac68k.stand', 'build.mac68k.shared', 'PlugIns']
2628

2729
# Helper routines
2830
def binhexit(path, name):
@@ -80,13 +82,15 @@ def hexbincwprojects(creator):
8082

8183
if srcfile[-1] == 'µ':
8284
dstfile = srcfile[:-1]+'mu.hqx'
85+
elif srcfile[-3] == '.mu':
86+
dstfile = srcfile + '.hqx'
8387
elif ord(srcfile[-1]) >= 128:
8488
dstfile = srcfile[:-1]+`ord(srcfile[-1])`+'.hqx'
8589
else:
8690
dstfile = srcfile + '.hqx'
8791

8892
if os.path.exists(dstfile) and \
89-
os.stat(dstfile)[8] > os.stat(srcfile)[8]:
93+
os.stat(dstfile)[8] >= os.stat(srcfile)[8]:
9094
print 'Skip', dstfile,'- Up-to-date'
9195
continue
9296
print 'Compacting', dstfile
@@ -104,20 +108,26 @@ def copycwproject(path, name):
104108
global project_files
105109

106110
dstdir = os.path.join(TOP, CWDIR)
107-
if not os.path.exists(dstdir):
108-
print dstdir
109-
print 'No CW-project dir, skip', name
110-
return
111-
dstfile = os.path.join(dstdir, name)
112-
# Check that we're not in the dest directory
113-
if dstfile == path:
111+
if path[:len(dstdir)] == dstdir:
114112
return
113+
srcdir = os.path.split(path)[0]
114+
srcdir = os.path.split(srcdir)[1]
115+
if srcdir in CWDIRDIRS:
116+
if not os.path.exists(dstdir):
117+
print dstdir
118+
print 'No CW-project dir, skip', name
119+
return
120+
dstfile = os.path.join(dstdir, name)
121+
else:
122+
if path[-2:] != '.µ':
123+
return
124+
dstfile = path[:-2]+ '.mu'
115125

116126
# If the destination doesn't exists or is older that the source
117127
# we copy and remember it
118128

119129
if os.path.exists(dstfile) and \
120-
os.stat(dstfile)[8] > os.stat(path)[8]:
130+
os.stat(dstfile)[8] >= os.stat(path)[8]:
121131
print 'Not copying', path,'- Up-to-date'
122132
else:
123133
print 'Copy', path
@@ -136,22 +146,28 @@ def copycwexpfile(path, name):
136146
global project_files
137147

138148
dstdir = os.path.join(TOP, CWDIR)
139-
if not os.path.exists(dstdir):
140-
print dstdir
141-
print 'No CW-project dir, skip', name
149+
if path[:len(dstdir)] == dstdir:
142150
return
143-
dstfile = os.path.join(dstdir, name)
151+
srcdir = os.path.split(path)[0]
152+
srcdir = os.path.split(srcdir)[1]
153+
if srcdir in CWDIRDIRS:
154+
if not os.path.exists(dstdir):
155+
print dstdir
156+
print 'No CW-project dir, skip', name
157+
return
158+
dstfile = os.path.join(dstdir, name)
159+
else:
160+
if path[-6:] != '.µ.exp':
161+
return
162+
dstfile = path[:-6] + '.mu.exp'
144163
if dstfile[-6:] == '.µ.exp':
145164
dstfile = dstfile[:-6]+'.mu.exp'
146-
# Check that we're not in the dest directory
147-
if dstfile == path:
148-
return
149165

150166
# If the destination doesn't exists or is older that the source
151167
# we copy and remember it
152168

153169
if os.path.exists(dstfile) and \
154-
os.stat(dstfile)[8] > os.stat(path)[8]:
170+
os.stat(dstfile)[8] >= os.stat(path)[8]:
155171
print 'Not copying', path,'- Up-to-date'
156172
else:
157173
print 'Copy', path

0 commit comments

Comments
 (0)