1 # Scan the tree passed as argv[0] for .rsrc files, skipping .rsrc.df.rsrc
2 # files, and open these. The effect of this is to create the .rsrc.df.rsrc
3 # cache files if needed.
4 # These are needed on OSX: the .rsrc files are in reality AppleSingle-encoded
5 # files. We decode the resources into a datafork-based resource file.
12 class NoArgsError(Exception):
15 def handler((verbose
, force
), dirname
, fnames
):
17 if fn
[-5:] == '.rsrc' and fn
[-13:] != '.rsrc.df.rsrc':
20 os
.unlink(os
.path
.join(dirname
, fn
+ '.df.rsrc'))
23 macresource
.open_pathname(os
.path
.join(dirname
, fn
), verbose
=verbose
)
27 opts
, args
= getopt
.getopt(sys
.argv
[1:], 'vf')
30 except (getopt
.GetoptError
, NoArgsError
):
31 sys
.stderr
.write('Usage: cachersrc.py dirname ...\n')
40 for dir in sys
.argv
[1:]:
41 os
.path
.walk(dir, handler
, (verbose
, force
))
43 if __name__
== '__main__':