Ejemplo n.º 1
0
	//////////////////////////////////////////////////////////////////////////
	/// Boot the settings subsystem from the given file (boot.ini).
	///
	/// @param file the file to use when booting.
	///
	/// @author mickem
	void NSCSettingsImpl::boot(std::string key) {
		std::list<std::string> order;
		if (!key.empty()) {
			order.push_back(key);
		} 
		boot_ = provider_->expand_path(BOOT_CONF_LOCATION);
		if (boost::filesystem::is_regular_file(boot_)) {
			get_logger()->debug("settings", __FILE__, __LINE__, "Boot.ini found in: " + boot_.string());
			for (int i=0;i<20;i++) {
				std::string v = get_boot_string("settings", strEx::s::xtos(i), "");
				if (!v.empty()) 
					order.push_back(expand_context(v));
			}
		}
		if (order.size() == 0) {
			get_logger()->debug("settings", __FILE__, __LINE__, "No entries found looking in (adding default): " + boot_.string());
			order.push_back(DEFAULT_CONF_OLD_LOCATION);
			order.push_back(DEFAULT_CONF_INI_LOCATION);
		}
		std::string boot_order;
		BOOST_FOREACH(const std::string &k, order) {
			strEx::append_list(boot_order, k, ", ");
		}
Ejemplo n.º 2
0
	//////////////////////////////////////////////////////////////////////////
	/// Boot the settings subsystem from the given file (boot.ini).
	///
	/// @param file the file to use when booting.
	///
	/// @author mickem
	void NSCSettingsImpl::boot(std::wstring key) {
		std::list<std::wstring> order;
		if (!key.empty()) {
			order.push_back(key);
		} 
		boot_ = provider_->expand_path(BOOT_CONF_LOCATION);
		if (file_helpers::checks::exists(boot_.string())) {
			get_logger()->debug(__FILE__, __LINE__, _T("Boot.ini found in: ") + boot_.string());
			for (int i=0;i<20;i++) {
				std::wstring v = get_boot_string(_T("settings"), strEx::itos(i), _T(""));
				if (!v.empty()) 
					order.push_back(expand_context(v));
			}
		}
		if (order.size() == 0) {
			get_logger()->debug(__FILE__, __LINE__, _T("No entries found looking in (adding default): ") + boot_.string());
			order.push_back(DEFAULT_CONF_OLD_LOCATION);
			order.push_back(DEFAULT_CONF_INI_LOCATION);
		}
		int i=0;
		std::wstring boot_order;
		BOOST_FOREACH(std::wstring k, order) {
			strEx::append_list(boot_order, k, _T(", "));
		}