Ejemplo n.º 1
0
bool ConfigManager::load() {
	clear();

	// Check that the config file actually exists.
	UString file = getConfigFile();
	if (!FilePath::isRegularFile(file))
		return false;

	try {

		// Open and load the config
		ReadFile config;
		if (!config.open(file))
			throw Exception(kOpenError);

		_config = new ConfigFile;
		_config->load(config);

		// Get the application domain
		_domainApp = _config->addDomain(kDomainApp);

	} catch (...) {
		exceptionDispatcherWarning("Failed loading config file \"%s\"", file.c_str());
		return false;
	}

	return true;
}