當前位置: 首頁>>代碼示例>>C++>>正文


C++ GetConfigPath函數代碼示例

本文整理匯總了C++中GetConfigPath函數的典型用法代碼示例。如果您正苦於以下問題:C++ GetConfigPath函數的具體用法?C++ GetConfigPath怎麽用?C++ GetConfigPath使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了GetConfigPath函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: TryDetectNonSysInPlaceEncSettings

// Returns the number of partitions where non-system in-place encryption is progress or had been in progress
// but was interrupted. In addition, via the passed pointer, returns the last selected wipe algorithm ID.
// nee int LoadNonSysInPlaceEncSettings (WipeAlgorithmId *wipeAlgorithm)
int TryDetectNonSysInPlaceEncSettings (WipeAlgorithmId *wipeAlgorithm)
{
	char *fileBuf = NULL;
	char *fileBuf2 = NULL;
	DWORD size, size2;
	int count;

	*wipeAlgorithm = TC_WIPE_NONE;

	if (!FileExists (GetConfigPath (TC_APPD_FILENAME_NONSYS_INPLACE_ENC)))
		return 0;

	if ((fileBuf = LoadFile (GetConfigPath (TC_APPD_FILENAME_NONSYS_INPLACE_ENC), &size)) == NULL)
		return 0;

	if (FileExists (GetConfigPath (TC_APPD_FILENAME_NONSYS_INPLACE_ENC_WIPE)))
	{
		if ((fileBuf2 = LoadFile (GetConfigPath (TC_APPD_FILENAME_NONSYS_INPLACE_ENC_WIPE), &size2)) != NULL)
			*wipeAlgorithm = (WipeAlgorithmId) atoi (fileBuf2);
	}

	count = atoi (fileBuf);

	if (fileBuf != NULL)
		TCfree (fileBuf);

	if (fileBuf2 != NULL)
		TCfree (fileBuf2);

	return (count);
}
開發者ID:nicnilov,項目名稱:truecrypt-api,代碼行數:34,代碼來源:Options.c

示例2: GetOptionsDB

void ServerConnectWnd::OkClicked()
{
    // record selected galaxy setup options as new defaults
    GetOptionsDB().Set("multiplayersetup.player-name",  m_player_name_edit->Text());
    GetOptionsDB().Set("multiplayersetup.host-address", m_IP_address_edit->Text());

    // Save the changes:
    {
        boost::filesystem::ofstream ofs(GetConfigPath());
        if (ofs) {
            GetOptionsDB().GetXML().WriteDoc(ofs);
        } else {
            std::cerr << UserString("UNABLE_TO_WRITE_CONFIG_XML") << std::endl;
            std::cerr << GetConfigPath().string() << std::endl;
            Logger().errorStream() << UserString("UNABLE_TO_WRITE_CONFIG_XML");
            Logger().errorStream() << GetConfigPath().string();
        }
    }

    m_result.first = *m_player_name_edit;
    if (m_host_or_join_radio_group->CheckedButton() == 0) {
        m_result.second = "HOST GAME SELECTED";
    } else {
        m_result.second = *m_IP_address_edit;
        if (m_result.second == "") {
            m_result.second =
                boost::polymorphic_downcast<GG::TextControl*>(
                    (***m_servers_lb->Selections().begin())[0])->Text();
        }
    }
    CUIWnd::CloseClicked();
}
開發者ID:fatman2021,項目名稱:FreeOrion,代碼行數:32,代碼來源:ServerConnectWnd.cpp

示例3: path

QString PathManager::GetDataBasePath()
{
	QString path("");
	if (!GetConfigPath().isEmpty()){
		path = GetConfigPath() + "/database.db";
	}
	return path;
}
開發者ID:cnandroidlib,項目名稱:AutopackingAndroid,代碼行數:8,代碼來源:PathManager.cpp

示例4: GetEditorPrefs

void wxSTEditorOptions::LoadConfig(wxConfigBase &config)
{
    if (HasConfigOption(STE_CONFIG_PREFS) && GetEditorPrefs().Ok())
        GetEditorPrefs().LoadConfig(config, GetConfigPath(STE_OPTION_CFGPATH_PREFS));
    if (HasConfigOption(STE_CONFIG_STYLES) && GetEditorStyles().Ok())
        GetEditorStyles().LoadConfig(config, GetConfigPath(STE_OPTION_CFGPATH_STYLES));
    if (HasConfigOption(STE_CONFIG_LANGS) && GetEditorLangs().Ok())
        GetEditorLangs().LoadConfig(config, GetConfigPath(STE_OPTION_CFGPATH_LANGS));
}
開發者ID:cubemoon,項目名稱:game-editor,代碼行數:9,代碼來源:steopts.cpp

示例5: GuideAlgorithm

GuideAlgorithmLowpass::GuideAlgorithmLowpass(Mount *pMount, GuideAxis axis)
    : GuideAlgorithm(pMount, axis)
{
    double minMove     = pConfig->Profile.GetDouble(GetConfigPath() + "/minMove", DefaultMinMove);
    SetMinMove(minMove);

    double slopeWeight = pConfig->Profile.GetDouble(GetConfigPath() + "/SlopeWeight", DefaultSlopeWeight);
    SetSlopeWeight(slopeWeight);

    reset();
}
開發者ID:hbaidu,項目名稱:open-phd-guiding,代碼行數:11,代碼來源:guide_algorithm_lowpass.cpp

示例6: GetConfigPath

/**
 * CSC_ParseDomainList
 *
 * @return     CDomainList*
 * @exception    -
 * @see        
 */
CDomainList *CSC_ParseDomainList(BOOL fullDownload)
{
    CDomainList *retval = new CDomainList;

    CCsvParse parser;
    CString filename = GetConfigPath() + (fullDownload?pszDomainFileName:pszOnlineDomainName);
    HRESULT hr = parser.Open(filename);
    if (FAILED(hr)) {
        FC_DEBUGPRINT1(_T("CSVPARS> file not found: %s\n"), filename);
        TrcPrint(TRC_ERROR, _T("CSVPARS> file not found: %s\n"), filename);
        return retval;
    }

    BOOL syntax = TRUE;
    for (;;) {
      CSC_DOMAINENTRY domain;
      CString strType, strFile;
      if (!parser.IsEndOfLine()) {
        syntax = FALSE;
        break;
      }
      BOOL ok = parser.ParseNextField(strType);
      if (!ok)
          break;
      strType.MakeLower();
      if (strType == _T("code"))
          domain.type = CSC_DOMAINTYPE_CODE;
      else if (strType == _T("init"))
          domain.type = CSC_DOMAINTYPE_INITIAL;
      else if (strType == _T("config"))
          domain.type = CSC_DOMAINTYPE_CONFIG;
      else if (strType == _T("custom"))
          domain.type = CSC_DOMAINTYPE_CUSTOM;
      else if (strType == _T("debug"))
          domain.type = CSC_DOMAINTYPE_DEBUG;
      else
          domain.type = CSC_DOMAINTYPE_UNKNOWN;
      syntax = parser.ParseNextField(strFile);
      if (!syntax)
          break;
      domain.file = GetConfigPath() + strFile;
      retval->AddTail(domain);
      while (!parser.IsEndOfLine() && parser.ParseNextField(strFile))
          ;
    }
    if (!syntax) {
        FC_DEBUGPRINT3(_T("CSVPARS> syntax error in %s(%d:%d)\n"), filename, parser.GetLineNo(), parser.GetLinePos());
        TrcPrint(TRC_ERROR, _T("CSVPARS> syntax error in %s(%d:%d)\n"), filename, parser.GetLineNo(), parser.GetLinePos());
    }
    return retval;
}
開發者ID:LM25TTD,項目名稱:ATCMcontrol_Engineering,代碼行數:58,代碼來源:Config.cpp

示例7: GuideAlgorithm

GuideAlgorithmResistSwitch::GuideAlgorithmResistSwitch(Mount *pMount, GuideAxis axis)
    : GuideAlgorithm(pMount, axis)
{
    double minMove  = pConfig->Profile.GetDouble(GetConfigPath() + "/minMove", DefaultMinMove);
    SetMinMove(minMove);

    double aggr = pConfig->Profile.GetDouble(GetConfigPath() + "/aggression", DefaultAggression);
    SetAggression(aggr);

    bool enable = pConfig->Profile.GetBoolean(GetConfigPath() + "/fastSwitch", true);
    SetFastSwitchEnabled(enable);

    reset();
}
開發者ID:AndresPozo,項目名稱:phd2,代碼行數:14,代碼來源:guide_algorithm_resistswitch.cpp

示例8: modList

Instance::Instance(const wxString &rootDir)
    : modList(this), m_running(false)
{
    if (!rootDir.EndsWith("/"))
        this->rootDir = wxFileName::DirName(rootDir + "/");
    else
        this->rootDir = wxFileName::DirName(rootDir);
    config = new wxFileConfig(wxEmptyString, wxEmptyString, GetConfigPath().GetFullPath(), wxEmptyString,
                              wxCONFIG_USE_LOCAL_FILE | wxCONFIG_USE_RELATIVE_PATH);
    evtHandler = NULL;
    MkDirs();

    // initialize empty mod lists - they are filled later and only if requested (see apropriate Get* methods)
    modList.SetDir(GetInstModsDir().GetFullPath());
    mlModList.SetDir(GetMLModsDir().GetFullPath());
    coreModList.SetDir(GetCoreModsDir().GetFullPath());
    worldList.SetDir(GetSavesDir().GetFullPath());
    tpList.SetDir(GetTexturePacksDir().GetFullPath());
    modloader_list_inited = false;
    coremod_list_inited = false;
    jar_list_inited = false;
    world_list_initialized = false;
    tp_list_initialized = false;
    parentModel = nullptr;
    UpdateVersion();
}
開發者ID:Glought,項目名稱:MultiMC4,代碼行數:26,代碼來源:instance.cpp

示例9: ERROR_INFO

bool GuideAlgorithmResistSwitch::SetMinMove(double minMove)
{
    bool bError = false;

    try
    {
        if (minMove <= 0.0)
        {
            throw ERROR_INFO("invalid minMove");
        }

        m_minMove = minMove;
        m_currentSide = 0;
    }
    catch (wxString Msg)
    {
        POSSIBLY_UNUSED(Msg);
        bError = true;
        m_minMove = DefaultMinMove;
    }

    pConfig->Profile.SetDouble(GetConfigPath() + "/minMove", m_minMove);

    Debug.Write(wxString::Format("GuideAlgorithmResistSwitch::SetMinMove() returns %d, m_minMove=%.2f\n", bError, m_minMove));

    return bError;
}
開發者ID:AndresPozo,項目名稱:phd2,代碼行數:27,代碼來源:guide_algorithm_resistswitch.cpp

示例10: M_SaveDefaults

void STACK_ARGS M_SaveDefaults (void)
{
	FILE *f;

	if (!DefaultsLoaded)
		return;

	std::string configfile = GetConfigPath();

	// Make sure the user hasn't changed configver
	configver.Set(CONFIGVERSIONSTR);

	if ( (f = fopen (configfile.c_str(), "w")) )
	{
		fprintf (f, "// Generated by Odamex " DOTVERSIONSTR " - don't hurt anything\n");

		// Archive all cvars marked as CVAR_ARCHIVE
		cvar_t::C_ArchiveCVars (f);

		// Archive all active key bindings
		//C_ArchiveBindings (f);

		// Archive all aliases
		DConsoleAlias::C_ArchiveAliases (f);

		// Archive master list
		SV_ArchiveMasters (f);

		fclose (f);
	}
}
開發者ID:JohnnyonFlame,項目名稱:odamex,代碼行數:31,代碼來源:m_misc.cpp

示例11: config_get_string

void OBSBasic::on_actionRemoveSceneCollection_triggered()
{
	std::string newName;
	std::string newPath;

	std::string oldFile = config_get_string(App()->GlobalConfig(),
			"Basic", "SceneCollectionFile");
	std::string oldName = config_get_string(App()->GlobalConfig(),
			"Basic", "SceneCollection");

	auto cb = [&](const char *name, const char *filePath)
	{
		if (strcmp(oldName.c_str(), name) != 0) {
			newName = name;
			newPath = filePath;
			return false;
		}

		return true;
	};

	EnumSceneCollections(cb);

	/* this should never be true due to menu item being grayed out */
	if (newPath.empty())
		return;

	QString text = QTStr("ConfirmRemove.Text");
	text.replace("$1", QT_UTF8(oldName.c_str()));

	QMessageBox::StandardButton button = QMessageBox::question(this,
			QTStr("ConfirmRemove.Title"), text);
	if (button == QMessageBox::No)
		return;

	char path[512];
	int ret = GetConfigPath(path, 512, "obs-studio/basic/scenes/");
	if (ret <= 0) {
		blog(LOG_WARNING, "Failed to get scene collection config path");
		return;
	}

	oldFile.insert(0, path);
	oldFile += ".json";
	os_unlink(oldFile.c_str());

	Load(newPath.c_str());
	RefreshSceneCollections();

	const char *newFile = config_get_string(App()->GlobalConfig(),
			"Basic", "SceneCollectionFile");

	blog(LOG_INFO, "Removed scene collection '%s' (%s.json), "
			"switched to '%s' (%s.json)",
			oldName.c_str(), oldFile.c_str(),
			newName.c_str(), newFile);
	blog(LOG_INFO, "------------------------------------------------");

	UpdateTitleBar();
}
開發者ID:chewcode,項目名稱:obs-studio,代碼行數:60,代碼來源:window-basic-main-scene-collections.cpp

示例12: ERROR_INFO

bool GuideAlgorithmHysteresis::SetHysteresis(double hysteresis)
{
    bool bError = false;

    try
    {
        if (hysteresis < 0.0 || hysteresis > MaxHysteresis)
        {
            throw ERROR_INFO("invalid hysteresis");
        }

        m_hysteresis = hysteresis;

    }
    catch (wxString Msg)
    {
        POSSIBLY_UNUSED(Msg);
        bError = true;
        m_hysteresis = wxMin(wxMax(hysteresis, 0.0), MaxHysteresis);
    }

    pConfig->Profile.SetDouble(GetConfigPath() + "/hysteresis", m_hysteresis);

    return bError;
}
開發者ID:hbaidu,項目名稱:open-phd-guiding,代碼行數:25,代碼來源:guide_algorithm_hysteresis.cpp

示例13: CSC_GetFileType

BOOL CSC_GetFileType(const CString& strFileName, CString& strFileType)
{
    CCsvParse parser;
	int found = 0;
	CString strFile;
	CString filename = GetConfigPath() + pszDomainFileName;

	HRESULT hr = parser.Open(filename);
	if (FAILED(hr)) {
		FC_DEBUGPRINT1(_T("CSVPARS> file not found: %s\n"), filename);
		TrcPrint(TRC_ERROR, _T("CSVPARS> file not found: %s\n"), filename);
	}
	else {
		while(1)
		{
			BOOL ok = parser.ParseNextField(strFileType);
			if (!ok)
				break;
			ok = parser.ParseNextField(strFile);
			if (!ok)
				break;
			if(strFileName.CompareNoCase(strFile) == 0)
			{
				found = 1;
				break;
			}
		}
		parser.Close();
	}

	if(!found) 
		strFileType = _T("unknown");

	return found;
}
開發者ID:LM25TTD,項目名稱:ATCMcontrol_Engineering,代碼行數:35,代碼來源:Config.cpp

示例14: GetConfigPath

void CAppConfig::SaveFavorites()
{
	string fpath = GetConfigPath("favorites");
	FILE* fo = fopen( fpath.c_str() , "w" );
	if( fo )
	{
		// bool has_sensitive_data = false;
		vector<CSite>::iterator it;
		for( it = Favorites.begin(); it != Favorites.end(); ++it )
		{
			CSite& site = *it;
			site.SaveToFile(fo);
			fputc( '\n', fo );

//			if( pSite->GetPasswd().length() )
//				has_sensitive_data = true;
		}
		fclose(fo);

//		if( ! has_sensitive_data )	// No data needs to be encrypted, cancel password.
//			SetUserPasswd( wxEmptyString );

		chmod(fpath.c_str(), 0600);	// Only the owner can access this file.
	}
}
開發者ID:lelou6666,項目名稱:pcmanx-gtk2,代碼行數:25,代碼來源:appconfig.cpp

示例15: M_SaveDefaults

void STACK_ARGS M_SaveDefaults (void)
{
	FILE *f;

	if (!DefaultsLoaded)
		return;

	std::string configfile = GetConfigPath();

	// Make sure the user hasn't changed configver
	configver.Set(CONFIGVERSIONSTR);

	if ( (f = fopen (configfile.c_str(), "w")) )
	{
		fprintf (f, "// Generated by Odasrv " DOTVERSIONSTR "\n\n");

		// Archive all cvars marked as CVAR_ARCHIVE
		fprintf (f, "// --- Console variables ---\n\n");
		cvar_t::C_ArchiveCVars (f);

		// Archive all active key bindings
		//fprintf (f, "// --- Key Bindings ---\n\n");
		//C_ArchiveBindings (f);

		// Archive all aliases
		fprintf (f, "\n// --- Aliases ---\n\n");
		DConsoleAlias::C_ArchiveAliases (f);

		fclose (f);
	}
}
開發者ID:JohnnyonFlame,項目名稱:odamex,代碼行數:31,代碼來源:m_misc.cpp


注:本文中的GetConfigPath函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。