def mergecfmfiles(srclist, dst, architecture='fat'):
 srclist = list(srclist)
 for i in range(len(srclist)):
  srclist[i] = Carbon.File.pathname(srclist[i])
 dst = Carbon.File.pathname(dst)
 dstfile = open(dst, 'wb')
 rf = Res.FSpOpenResFile(dst, 3)
 try:
  dstcfrg = CfrgResource()
  for src in srclist:
   srccfrg = CfrgResource(src)
   for frag in srccfrg.fragments:
    if ((frag.architecture == 'pwpc') and (architecture == 'm68k')):
     continue
    if ((frag.architecture == 'm68k') and (architecture == 'pwpc')):
     continue
    dstcfrg.append(frag)
    frag.copydata(dstfile)
  cfrgres = Res.Resource(dstcfrg.build())
  Res.UseResFile(rf)
  cfrgres.AddResource('cfrg', 0, '')
 finally:
  dstfile.close()
  rf = Res.CloseResFile(rf)

def mergecfmfiles ( srclist , dst , architecture = 'fat' ) : srclist = list ( srclist ) for i in range ( len ( srclist ) ) : srclist [ i ] = Carbon . File . pathname ( srclist [ i ] ) dst = Carbon . File . pathname ( dst ) dstfile = open ( dst , 'wb' ) rf = Res . FSpOpenResFile ( dst , 3 ) try : dstcfrg = CfrgResource ( ) for src in srclist : srccfrg = CfrgResource ( src ) for frag in srccfrg . fragments : if ( ( frag . architecture == 'pwpc' ) and ( architecture == 'm68k' ) ) : continue if ( ( frag . architecture == 'm68k' ) and ( architecture == 'pwpc' ) ) : continue dstcfrg . append ( frag ) frag . copydata ( dstfile ) cfrgres = Res . Resource ( dstcfrg . build ( ) ) Res . UseResFile ( rf ) cfrgres . AddResource ( 'cfrg' , 0 , '' ) finally : dstfile . close ( ) rf = Res . CloseResFile ( rf )
merge all files in srclist into a new file dst .