My Project
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Functions
res2cc_cmd Namespace Reference

Classes

class  File
 
class  VerbatimFile
 
class  CSSFile
 
class  LumFile
 
class  LumaFile
 

Functions

def main
 

Function Documentation

def res2cc_cmd.main ( )

Definition at line 95 of file res2cc_cmd.py.

95 
96 def main():
97  if len(sys.argv)<3:
98  sys.exit('Usage: %s directory output_file.cpp' % sys.argv[0])
99  directory = sys.argv[1]
100  files = []
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
104  if subdir:
105  files.append(File.factory(directory,subdir,fname))
106  outputFile = open(sys.argv[2],"w")
107  print("#include \"resourcemgr.h\"\n",file=outputFile)
108  for f in files:
109  f.writeContents(outputFile)
110  print("static Resource resourceDir[] =",file=outputFile)
111  print("{",file=outputFile)
112  for f in files:
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)