Classes | Functions
res2cc_cmd Namespace Reference

Classes

class  CSSFile
 
class  File
 
class  LumaFile
 
class  LumFile
 
class  VerbatimFile
 

Functions

def main ()
 

Function Documentation

def res2cc_cmd.main ( void  )

Definition at line 95 of file res2cc_cmd.py.

95 def main():
96  if len(sys.argv)<3:
97  sys.exit('Usage: %s directory output_file.cpp' % sys.argv[0])
98  directory = sys.argv[1]
99  files = []
100  for dirName, subdirList, fileList in walk(directory):
101  for fname in sorted(fileList):
102  subdir = dirName[len(directory)+1:] if dirName.startswith(directory) else dirName
103  if subdir:
104  files.append(File.factory(directory,subdir,fname))
105  outputFile = open(sys.argv[2],"w")
106  print("#include \"resourcemgr.h\"\n",file=outputFile)
107  for f in files:
108  f.writeContents(outputFile)
109  print("static Resource resourceDir[] =",file=outputFile)
110  print("{",file=outputFile)
111  for f in files:
112  f.writeDirEntry(outputFile)
113  print("};",file=outputFile)
114  print("static int resourceDir_len = %s;" % len(files), file=outputFile)
115  print("void initResources() { ResourceMgr::instance().registerResources(resourceDir,resourceDir_len); }",file=outputFile)
116 
def main()
Definition: res2cc_cmd.py:95
int open(const char *, int)
Opens a file descriptor.
def walk(top, topdown=True)