本文整理汇总了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);
}
示例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();
}
示例3: path
QString PathManager::GetDataBasePath()
{
QString path("");
if (!GetConfigPath().isEmpty()){
path = GetConfigPath() + "/database.db";
}
return path;
}
示例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));
}
示例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();
}
示例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;
}
示例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();
}
示例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();
}
示例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;
}
示例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);
}
}
示例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();
}
示例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;
}
示例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;
}
示例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.
}
}
示例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);
}
}