コード例 #1
0
void ConfigManager::readConfiguration() {
    string homeDir = getenv ("HOME");
    this->configurationFile = homeDir + "/.config/garminplugin/garminplugin.xml";

    try
    {
        this->configuration = new TiXmlDocument(this->configurationFile );
        if (this->configuration->LoadFile())
        {
            return;
        }
    }
    catch(ticpp::Exception& ex)
    {
        if (Log::enabledInfo()) Log::info("Failed reading configuration from "+this->configurationFile);
    }

    this->configurationFile = homeDir + "/.garminplugin.xml";
    try
    {
        this->configuration = new TiXmlDocument(this->configurationFile );
        if (this->configuration->LoadFile())
        {
            return;
        }
    }
    catch(ticpp::Exception& ex)
    {
        if (Log::enabledInfo()) Log::info("Failed reading configuration from "+this->configurationFile);
    }

    configuration = createNewConfiguration();
}
コード例 #2
0
void ConfigManager::readConfiguration() {
    string homeDir = getenv ("HOME");
    this->configurationFile = homeDir + "/.config/garminplugin/garminplugin.xml";

    if (this->configuration != NULL) {
        delete (this->configuration);
        this->configuration = NULL;
    }

    this->configuration = new TiXmlDocument(this->configurationFile );
    if (this->configuration->LoadFile())
    {
        return;
    }

    this->configurationFile = homeDir + "/.garminplugin.xml";
    this->configuration = new TiXmlDocument(this->configurationFile );
    if (this->configuration->LoadFile())
    {
        return;
    }

    configuration = createNewConfiguration();
}