24 int main(
int argc,
char** argv)
26 Console::println(
string(
"createrc ") + Version::getVersion());
27 Console::println(Version::getCopyright());
31 Console::println(
"Usage: createrc path_to_rc file path_to_generated_rc");
32 Application::exit(Application::EXITCODE_FAILURE);
36 string rcInFileName = argv[1];
37 string fileName = argv[2];
38 string rcOutFileName = argv[3];
42 auto rc = FileSystem::getInstance()->getContentAsString(
43 FileSystem::getInstance()->getPathName(rcInFileName),
44 FileSystem::getInstance()->getFileName(rcInFileName)
48 if (StringTools::endsWith(fileName,
".exe") ==
true) {
49 auto executable = StringTools::substring(fileName, fileName.rfind(
'/') + 1, fileName.find(
".exe"));
50 auto executableLowerCase = StringTools::toLowerCase(executable);
51 rc = StringTools::replace(rc,
"{__EXECUTABLE__}", executable);
52 if (FileSystem::getInstance()->exists(
"resources/platforms/win32/" + executableLowerCase +
"-icon.ico") ==
true) {
53 rc = StringTools::replace(rc,
"{__ICON__}",
"resources/platforms/win32/" + executableLowerCase +
"-icon.ico");
55 rc = StringTools::replace(rc,
"{__ICON__}",
"resources/platforms/win32/default-icon.ico");
58 if (StringTools::endsWith(fileName,
".dll") ==
true) {
59 auto library = StringTools::substring(fileName, fileName.rfind(
'/') + 1, fileName.find(
".dll"));
60 rc = StringTools::replace(rc,
"{__LIBRARY__}", library);
64 FileSystem::getInstance()->setContentFromString(
65 FileSystem::getInstance()->getPathName(rcOutFileName),
66 FileSystem::getInstance()->getFileName(rcOutFileName),
72 Console::println(
string() +
"An error occurred: " + exception.what());
76 Application::exit(Application::EXITCODE_SUCCESS);
Application base class, please make sure to allocate application on heap to have correct application ...
File system singleton class.
int main(int argc, char **argv)
std::exception Exception
Exception base class.