| 2726 | // clang-format on |
| 2727 | |
| 2728 | void Application::initConfig(int argc, char ** argv) |
| 2729 | { |
| 2730 | // find the home path.... |
| 2731 | mConfig["AppHomePath"] = Base::FileInfo::pathToString( |
| 2732 | ApplicationDirectories::findHomePath(argv[0]) |
| 2733 | ); |
| 2734 | |
| 2735 | // Version of the application extracted from SubWCRef into src/Build/Version.h |
| 2736 | // We only set these keys if not yet defined. Therefore it suffices to search |
| 2737 | // only for 'BuildVersionMajor'. |
| 2738 | if (Application::Config().find("BuildVersionMajor") == Application::Config().end()) { |
| 2739 | std::stringstream str; |
| 2740 | str << FCVersionMajor |
| 2741 | << "." << FCVersionMinor |
| 2742 | << "." << FCVersionPoint; |
| 2743 | Application::Config()["ExeVersion" ] = str.str(); |
| 2744 | Application::Config()["BuildVersionMajor" ] = FCVersionMajor; |
| 2745 | Application::Config()["BuildVersionMinor" ] = FCVersionMinor; |
| 2746 | Application::Config()["BuildVersionPoint" ] = FCVersionPoint; |
| 2747 | Application::Config()["BuildVersionSuffix" ] = FCVersionSuffix; |
| 2748 | Application::Config()["BuildRevision" ] = FCRevision; |
| 2749 | Application::Config()["BuildRepositoryURL" ] = FCRepositoryURL; |
| 2750 | Application::Config()["BuildRevisionDate" ] = FCRevisionDate; |
| 2751 | #if defined(FCRepositoryHash) |
| 2752 | Application::Config()["BuildRevisionHash" ] = FCRepositoryHash; |
| 2753 | #endif |
| 2754 | #if defined(FCRepositoryBranch) |
| 2755 | Application::Config()["BuildRevisionBranch"] = FCRepositoryBranch; |
| 2756 | #endif |
| 2757 | } |
| 2758 | |
| 2759 | _argc = argc; |
| 2760 | _argv = argv; |
| 2761 | |
| 2762 | // Now it's time to read-in the file branding.xml if it exists |
| 2763 | Branding brand; |
| 2764 | QString binDir = QString::fromUtf8((mConfig["AppHomePath"] + "bin").c_str()); |
| 2765 | QFileInfo fi(binDir, QStringLiteral("branding.xml")); |
| 2766 | if (fi.exists() && brand.readFile(fi.absoluteFilePath())) { |
| 2767 | Branding::XmlConfig cfg = brand.getUserDefines(); |
| 2768 | for (Branding::XmlConfig::iterator it = cfg.begin(); it != cfg.end(); ++it) { |
| 2769 | Application::Config()[it.key()] = it.value(); |
| 2770 | } |
| 2771 | } |
| 2772 | |
| 2773 | boost::program_options::variables_map vm; |
| 2774 | { |
| 2775 | BOOST_SCOPE_EXIT_ALL(&) { |
| 2776 | // console-mode needs to be set (if possible) also in case parseProgramOptions |
| 2777 | // throws, as it's needed when reporting such exceptions |
| 2778 | if (vm.contains("console")) { |
| 2779 | mConfig["Console"] = "1"; |
| 2780 | mConfig["RunMode"] = "Cmd"; |
| 2781 | } |
| 2782 | }; |
| 2783 | parseProgramOptions(argc, argv, mConfig["ExeName"], vm); |
| 2784 | } |
| 2785 |
nothing calls this directly
no test coverage detected