98 sys.exit(
'Usage: %s directory output_file.cpp' % sys.argv[0])
99 directory = sys.argv[1]
101 for dirName, subdirList, fileList
in walk(directory):
102 for fname
in sorted(fileList):
103 subdir = dirName[len(directory)+1:]
if dirName.startswith(directory)
else dirName
105 files.append(File.factory(directory,subdir,fname))
106 outputFile = open(sys.argv[2],
"w")
107 print(
"#include \"resourcemgr.h\"\n",file=outputFile)
109 f.writeContents(outputFile)
110 print(
"static Resource resourceDir[] =",file=outputFile)
111 print(
"{",file=outputFile)
113 f.writeDirEntry(outputFile)
114 print(
"};",file=outputFile)
115 print(
"static int resourceDir_len = %s;" % len(files), file=outputFile)
116 print(
"void initResources() { ResourceMgr::instance().registerResources(resourceDir,resourceDir_len); }",file=outputFile)