Repository: FreeCAD/FreeCAD
File: src/App/Application.cpp (C++)

Code before:
#ifdef OCC_VERSION_STRING_EXT
    mConfig["OCC_VERSION"] = OCC_VERSION_STRING_EXT;
#endif
    mConfig["BOOST_VERSION"] = BOOST_LIB_VERSION;
    mConfig["PYTHON_VERSION"] = PY_VERSION;
    mConfig["QT_VERSION"] = QT_VERSION_STR;
    mConfig["EIGEN_VERSION"] = fcEigen3Version;
    mConfig["PYSIDE_VERSION"] = fcPysideVersion;
#ifdef SMESH_VERSION_STR
    mConfig["SMESH_VERSION"] = SMESH_VERSION_STR;
#endif
    mConfig["XERCESC_VERSION"] = fcXercescVersion;


    logStatus();

    if (vm.contains("verbose") && vm.contains("version")) {
        Application::_pcSingleton = new Application(mConfig);
        throw Base::ProgramInformation(Application::verboseVersionEmitMessage);
    }
}

void Application::SaveEnv(const char* s)
{
    auto c = getenvUTF8(s);
    if (c) {
        mConfig[s] = c.value();
    }
}

void Application::initApplication()
{
    // interpreter and Init script ==========================================================
    // register scripts
    new Base::ScriptProducer( "CMakeVariables", CMakeVariables );
    new Base::ScriptProducer( "FreeCADInit",    FreeCADInit    );
    new Base::ScriptProducer( "FreeCADTest",    FreeCADTest    );

    // creating the application
    if (mConfig["Verbose"] != "Strict")
        Base::Console().log("Create Application\n");
    Application::_pcSingleton = new Application(mConfig);

    // set up Unit system default
    const ParameterGrp::handle hGrp = GetApplication().GetParameterGroupByPath
       ("User parameter:BaseApp/Preferences/Units");
    Base::UnitsApi::setSchema(hGrp->GetInt("UserSchema", Base::UnitsApi::getDefSchemaNum()));
    Base::UnitsApi::setDecimals(hGrp->GetInt("Decimals", Base::UnitsApi::getDecimals()));
    Base::UnitsApi::setDenominator(hGrp->GetInt("FracInch", Base::UnitsApi::getDenominator()));

#if defined (_DEBUG)

Review comment (suggestion):
since the code is touched anyway:

```suggestion
    if (auto c = getenvUTF8(s)) {
```

Code after:
#ifdef OCC_VERSION_STRING_EXT
    mConfig["OCC_VERSION"] = OCC_VERSION_STRING_EXT;
#endif
    mConfig["BOOST_VERSION"] = BOOST_LIB_VERSION;
    mConfig["PYTHON_VERSION"] = PY_VERSION;
    mConfig["QT_VERSION"] = QT_VERSION_STR;
    mConfig["EIGEN_VERSION"] = fcEigen3Version;
    mConfig["PYSIDE_VERSION"] = fcPysideVersion;
#ifdef SMESH_VERSION_STR
    mConfig["SMESH_VERSION"] = SMESH_VERSION_STR;
#endif
    mConfig["XERCESC_VERSION"] = fcXercescVersion;


    logStatus();

    if (vm.contains("verbose") && vm.contains("version")) {
        Application::_pcSingleton = new Application(mConfig);
        throw Base::ProgramInformation(Application::verboseVersionEmitMessage);
    }
}

void Application::SaveEnv(const char* s)
{
    if (auto c = getenvUTF8(s)) {
        mConfig[s] = c.value();
    }
}

void Application::initApplication()
{
    // interpreter and Init script ==========================================================
    // register scripts
    new Base::ScriptProducer( "CMakeVariables", CMakeVariables );
    new Base::ScriptProducer( "FreeCADInit",    FreeCADInit    );
    new Base::ScriptProducer( "FreeCADTest",    FreeCADTest    );

    // creating the application
    if (mConfig["Verbose"] != "Strict")
        Base::Console().log("Create Application\n");
    Application::_pcSingleton = new Application(mConfig);

    // set up Unit system default
    const ParameterGrp::handle hGrp = GetApplication().GetParameterGroupByPath
       ("User parameter:BaseApp/Preferences/Units");
    Base::UnitsApi::setSchema(hGrp->GetInt("UserSchema", Base::UnitsApi::getDefSchemaNum()));
    Base::UnitsApi::setDecimals(hGrp->GetInt("Decimals", Base::UnitsApi::getDecimals()));
    Base::UnitsApi::setDenominator(hGrp->GetInt("FracInch", Base::UnitsApi::getDenominator()));

#if defined (_DEBUG)
    Base::Console().log("Application is built with debug information\n");