本文整理汇总了C++中FileName::DirExists方法的典型用法代码示例。如果您正苦于以下问题:C++ FileName::DirExists方法的具体用法?C++ FileName::DirExists怎么用?C++ FileName::DirExists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileName
的用法示例。
在下文中一共展示了FileName::DirExists方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetDataDirectory
wxString GUI::GetDataDirectory()
{
std::string cfg_str = g_settings.getString(Config::DATA_DIRECTORY);
if(cfg_str.size()) {
FileName dir;
dir.Assign(wxstr(cfg_str));
wxString path;
if(dir.DirExists()) {
path = dir.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR);
return path;
}
}
// Silently reset directory
FileName exec_directory;
try
{
exec_directory = dynamic_cast<wxStandardPaths&>(wxStandardPaths::Get()).GetExecutablePath();
}
catch(std::bad_cast)
{
throw; // Crash application (this should never happend anyways...)
}
exec_directory.AppendDir(wxT("data"));
return exec_directory.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR);
}
示例2: GetExtensionsDirectory
wxString GUI::GetExtensionsDirectory()
{
std::string cfg_str = g_settings.getString(Config::EXTENSIONS_DIRECTORY);
if(cfg_str.size()) {
FileName dir;
dir.Assign(wxstr(cfg_str));
wxString path;
if(dir.DirExists()) {
path = dir.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR);
return path;
}
}
// Silently reset directory
FileName local_directory = GetLocalDirectory();
local_directory.AppendDir(wxT("extensions"));
local_directory.Mkdir(0755, wxPATH_MKDIR_FULL);
return local_directory.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR);
}