int main(int argc, const char* argv[]) { const char *description = "\n" "QtBinPatcher v2.3.0Beta. Tool for patching paths in Qt binaries.\n" "Yuri V. Krugloff, 2013-2015. http://www.tver-soft.org\n" "Frank Su, 2016. http://mogara.org\n" "This is free software released into the public domain.\n" #ifdef QTCROSS "This binary is built for cross compiled Qt.\n" #endif "\n" ; LOG(description); TCmdLineParser CmdLineParser(argc, argv); if (CmdLineParser.hasError()) { LOG("%s\n", CmdLineParser.errorString().c_str()); howToUseMessage(); return -1; } const TStringListMap& argsMap = CmdLineParser.argsMap(); std::string ErrorString = TCmdLineChecker::check(argsMap); if (!ErrorString.empty()) { LOG("%s\n", ErrorString.c_str()); howToUseMessage(); return -1; } TLogger::setVerbose(argsMap.contains(OPT_VERBOSE)); LOG_SET_FILENAME(argsMap.value(OPT_LOGFILE).c_str()); LOG_V("%s\n", CmdLineParser.dump().c_str()); LOG_V("Working directory: \"%s\".\n", Functions::currentDir().c_str()); LOG_V("Binary file location: \"%s\".\n", argv[0]); if (argsMap.contains(OPT_HELP)) { howToUseMessage(); return 0; } if (argsMap.contains(OPT_VERSION)) return 0; return TQtBinPatcher::exec(argsMap) ? 0 : -1; }
int main(int argc, char *argv[]) { json_object * str = json_object_new_string("c**t\n"); std::cout << "My string is " << json_object_get_string(str); #ifdef __APPLE__ CFBundleRef mainBundle = CFBundleGetMainBundle(); CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle); char path[PATH_MAX]; if (!CFURLGetFileSystemRepresentation(resourcesURL, TRUE, (UInt8 *)path, PATH_MAX)) { // error! } CFRelease(resourcesURL); chdir(path); std::cout << "Current Path: " << path << std::endl; #endif #ifdef _DEBUG #ifdef __LINUX__ // !!!! MOVE THIS TO MAIN STARTUP !!!! const std::string delim = "/" #else const std::string delim = "\\"; #endif // __LINUX__ std::string log_file = "Logfiles" + delim + "tiles.txt"; LOG_SET_FILENAME(log_file.c_str()); #endif // _DEBUG std::cout << getwd << std::endl; Engine engine; if (!engine.Initialise()) return -1; engine.ChangeState(SplashState::GetInstance()); while (engine.IsRunning()) { engine.HandleEvents(); engine.Update(); engine.Render(); } #ifdef _DEBUG LOG_WRITE_FILE; #endif return 0; }