本文整理汇总了C++中wxFileName::IsOk方法的典型用法代码示例。如果您正苦于以下问题:C++ wxFileName::IsOk方法的具体用法?C++ wxFileName::IsOk怎么用?C++ wxFileName::IsOk使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxFileName
的用法示例。
在下文中一共展示了wxFileName::IsOk方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OpenDatabase
void TagsDatabase::OpenDatabase(const wxFileName& fileName)
{
if(m_fileName == fileName)
return;
// Did we get a file name to use?
if(!fileName.IsOk() && !m_fileName.IsOk())
return;
// We did not get any file name to use BUT we
// do have an open database, so we will use it
if(!fileName.IsOk())
return;
if(!m_fileName.IsOk())
{
// First time we open the db
m_db->Open(fileName.GetFullPath());
CreateSchema();
m_fileName = fileName;
}
else
{
// We have both fileName & m_fileName and they
// are different, Close previous db
m_db->Close();
m_db->Open(fileName.GetFullPath());
CreateSchema();
m_fileName = fileName;
}
}
示例2: FindEntry
const wxExVCSEntry wxExVCS::FindEntry(const wxFileName& filename)
{
const int vcs = wxConfigBase::Get()->ReadLong("VCS", VCS_AUTO);
if (vcs == VCS_AUTO)
{
if (filename.IsOk())
{
for (
auto it = m_Entries.begin();
it != m_Entries.end();
++it)
{
const bool toplevel = it->AdminDirIsTopLevel();
const wxString admin_dir = it->GetAdminDir();
if (toplevel && IsAdminDirTopLevel(admin_dir, filename))
{
return *it;
}
else if (IsAdminDir(admin_dir, filename))
{
return *it;
}
}
}
}
else if (vcs >= VCS_START && vcs < m_Entries.size())
{
return m_Entries[vcs];
}
return wxExVCSEntry();
}
示例3: WinPathToCygwin
wxString eDocumentPath::WinPathToCygwin(const wxFileName& path) {
wxASSERT(path.IsOk() && path.IsAbsolute());
#ifndef __WXMSW__
return path.GetFullPath();
#else
wxString fullpath = path.GetFullPath();
// Check if we have a foward-slash unc path; cygwin can handle these directly.
if (fullpath.StartsWith(wxT("//"))) {
return fullpath;
}
// Check if we have a backslash unc path; convert to forward slash and pass on.
if (fullpath.StartsWith(wxT("\\\\"))) {
fullpath.Replace(wxT("\\"), wxT("/"));
return fullpath;
}
// Convert C:\... to /cygdrive/c/...
wxString unixPath = eDocumentPath::s_cygdrivePrefix + path.GetVolume().Lower();
// Convert slashs in path segments
const wxArrayString& dirs = path.GetDirs();
for (unsigned int i = 0; i < dirs.GetCount(); ++i) {
unixPath += wxT('/') + dirs[i];
}
// Add the filename, if there is one
if (path.HasName()) unixPath += wxT('/') + path.GetFullName();
return unixPath;
#endif
}
示例4: HasFSOExecutables
bool FSOExecutable::HasFSOExecutables(const wxFileName& path) {
wxCHECK_MSG(path.IsOk(), false,
wxString::Format(_T("provided path %s to HasFSOExecutables is invalid"),
path.GetFullPath().c_str()));
return !FSOExecutable::GetBinariesFromRootFolder(path, true).IsEmpty();
}
示例5: GetUserDir
/*
This routine is platform-independent.
MMEX is a portable application which means ability to to run
without installation, for example, from USB flash drive.
If mmex finds mmexini.db3 in its folder, it assumes portable
mode and GetUserDir() in such case points to that folder.
FIXME: security issue - temp files will be created on host filesystem.
*/
const wxFileName mmex::GetUserDir(bool create)
{
static wxFileName fname;
if (!fname.IsOk())
{
fname = getSettingsPathPortable();
bool portable_file_ok = fname.IsFileWritable() && fname.IsFileReadable();
if (!portable_file_ok)
{
fname.AssignDir(wxStandardPaths::Get().GetUserDataDir());
if (create && !fname.DirExists())
{
portable_file_ok = fname.Mkdir(0700, wxPATH_MKDIR_FULL); // 0700 - octal, "111 000 000"
wxASSERT(portable_file_ok);
}
}
fname.SetFullName(wxGetEmptyString());
}
return fname;
}
示例6: IsAdminDirTopLevel
bool wxExVCS::IsAdminDirTopLevel(
const wxString& admin_dir,
const wxFileName& fn)
{
if (!fn.IsOk() || admin_dir.empty())
{
return false;
}
// The .git dir only exists in the root, so check all components.
wxFileName root(fn);
while (root.DirExists() && root.GetDirCount() > 0)
{
wxFileName path(root);
path.AppendDir(admin_dir);
if (path.DirExists() && !path.FileExists())
{
return true;
}
root.RemoveLastDir();
}
return false;
}
示例7: NormalizePath
bool NormalizePath(wxFileName& f,const wxString& base)
{
bool result = true;
// if (!f.IsAbsolute())
{
f.Normalize(wxPATH_NORM_ALL & ~wxPATH_NORM_CASE, base);
result = f.IsOk();
}
return result;
}
示例8: SelectTagsByFile
wxSQLite3ResultSet TagsDatabase::SelectTagsByFile(const wxString& file, const wxFileName& path)
{
// Incase empty file path is provided, use the current file name
wxFileName databaseFileName(path);
path.IsOk() == false ? databaseFileName = m_fileName : databaseFileName = path;
OpenDatabase(databaseFileName);
wxString query;
query = wxString::Format(_T("select * from tags where file='%s';"), file.GetData());
return m_db->ExecuteQuery(query.GetData());
}
示例9: GetSharedDir
/*
$(prefix)/share/mmex.
Default install prefix is /usr (often /usr/local).
*/
const wxFileName mmex::GetSharedDir()
{
static wxFileName fname;
if (!fname.IsOk())
{
SetInstallPrefix();
fname = wxFileName::DirName(wxStandardPaths::Get().GetDataDir());
}
return fname;
}
示例10: GetResourceDir
/*
$(prefix)/share/mmex/res
*/
const wxFileName mmex::GetResourceDir()
{
static wxFileName fname;
if (!fname.IsOk())
{
fname = GetSharedDir();
fname.AppendDir("res");
}
return fname;
}
示例11: GetDocDir
const wxFileName mmex::GetDocDir()
{
static wxFileName fname;
if (!fname.IsOk())
{
fname = GetSharedDir();
fname.AppendDir("doc");
}
return fname;
}
示例12: GetLogDir
const wxFileName mmex::GetLogDir(bool create)
{
static wxFileName fname;
if (!fname.IsOk())
{
fname = GetUserDir(create);
//FIXME: file not found ERROR
//fname.AppendDir("logs");
}
return fname;
}
示例13: wxFileName
CMP_LIBRARY::CMP_LIBRARY( int aType, const wxFileName& aFileName )
{
type = aType;
isModified = false;
timeStamp = 0;
isCache = false;
timeStamp = wxDateTime::Now();
if( aFileName.IsOk() )
fileName = aFileName;
else
fileName = wxFileName( wxT( "unnamed.lib" ) );
}
示例14: ReadImage
bool ArtDrvSim::ReadImage(const wxFileName &simName)
{
FILE* ifi;
if (!simName.IsOk()) return false;
if ( (ifi = ::fopen(simName.GetFullPath().fn_str(), "rb"))==NULL) {
// open fails...
return false;
}
size_t fLength = m_camProps.nPixelsX*m_camProps.nPixelsY * 2;
size_t fRead = ::fread(m_imageData, 1, fLength, ifi);
::fclose(ifi);
return (fLength==fRead);
}
示例15: IsAdminDir
bool wxExVCS::IsAdminDir(
const wxString& admin_dir,
const wxFileName& fn)
{
if (admin_dir.empty() || !fn.IsOk())
{
return false;
}
// these cannot be combined, as AppendDir is a void (2.9.1).
wxFileName path(fn);
path.AppendDir(admin_dir);
return path.DirExists() && !path.FileExists();
}