MCPcopy Create free account
hub / github.com/OpenKinect/libfreenect2 / main

Function main

tools/generate_resources.cpp:67–98  ·  view source on GitHub ↗

* Main application entry point. * Arguments: List of files to add as resource. */

Source from the content-addressed store, hash-verified

65 * Arguments: List of files to add as resource.
66 */
67int main(int argc, char **argv)
68{
69 if(argc < 2) return -1;
70
71 using namespace std;
72
73 string basefolder(argv[1]);
74
75 for(int i = 2; i < argc; ++i)
76 {
77 cout << "static unsigned char resource" << (i - 2) << "[] = {" << endl;
78 dumpFile(basefolder + "/" + argv[i]);
79 cout << "};" << endl;
80 }
81
82 cout << "static ResourceDescriptor resource_descriptors[] = {" << endl;
83
84 for(int i = 2; i < argc; ++i)
85 {
86 string path(argv[i]);
87 size_t last_slash = path.find_last_of("\\/");
88 if (last_slash != std::string::npos)
89 path.erase(0, last_slash + 1);
90 cout << " { \"" << path << "\", resource" << (i - 2) << ", " << "sizeof(resource" << (i - 2) << ") }," << endl;
91 }
92
93 cout << " {NULL, NULL, 0}," << endl;
94 cout << "};" << endl;
95 cout << "static int resource_descriptors_length = " << (argc - 2) << ";" << endl;
96
97 return 0;
98}

Callers

nothing calls this directly

Calls 1

dumpFileFunction · 0.85

Tested by

no test coverage detected