bool vfsLocalDir::Open(const std::string& path) { if(!vfsDirBase::Open(path)) return false; wxDir dir; if(!dir.Open(path)) return false; wxString name; for(bool is_ok = dir.GetFirst(&name); is_ok; is_ok = dir.GetNext(&name)) { wxString dir_path = fmt::FromUTF8(path) + name; m_entries.emplace_back(); DirEntryInfo& info = m_entries.back(); info.name = fmt::ToUTF8(name); info.flags |= dir.Exists(dir_path) ? DirEntry_TypeDir : DirEntry_TypeFile; if(wxIsWritable(dir_path)) info.flags |= DirEntry_PermWritable; if(wxIsReadable(dir_path)) info.flags |= DirEntry_PermReadable; if(wxIsExecutable(dir_path)) info.flags |= DirEntry_PermExecutable; } return true; }
bool CPath::IsFile(EAccess mode) const { if (!wxFileName::FileExists(m_filesystem)) { return false; } else if ((mode & writable) && !wxIsWritable(m_filesystem)) { return false; } else if ((mode & readable) && !wxIsReadable(m_filesystem)) { return false; } return true; }
bool CPath::IsDir(EAccess mode) const { wxString path = DoCleanPath(m_filesystem); if (!wxFileName::DirExists(path)) { return false; } else if ((mode & writable) && !wxIsWritable(path)) { return false; } else if ((mode & readable) && !wxIsReadable(path)) { return false; } return true; }
//thread to check if remote folder is readable //before exit we assume that folder is not readable wxThread::ExitCode wxGxDiscConnectionUI::Entry() { while (!GetThread()->TestDestroy()) { bool bIsOk = wxIsReadable(wxString(m_sPath, wxConvUTF8)); char nIsReadable = bIsOk == true ? 1 : 0; if (nIsReadable != m_nIsReadable) { m_nIsReadable = nIsReadable; if (m_nIsReadable == FALSE) { wxGxDiscConnection::DestroyChildren(); } wxGIS_GXCATALOG_EVENT(ObjectChanged); } wxThread::Sleep(TM_CHECKING); } return (wxThread::ExitCode)wxTHREAD_NO_ERROR; }