本文整理汇总了C++中CServerPath::GetSafePath方法的典型用法代码示例。如果您正苦于以下问题:C++ CServerPath::GetSafePath方法的具体用法?C++ CServerPath::GetSafePath怎么用?C++ CServerPath::GetSafePath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CServerPath
的用法示例。
在下文中一共展示了CServerPath::GetSafePath方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddBookmark
bool CBookmarksDialog::AddBookmark(const wxString &name, const wxString &local_dir, const CServerPath &remote_dir, bool sync)
{
if (local_dir.empty() && remote_dir.empty())
return false;
if ((local_dir.empty() || remote_dir.empty()) && sync)
return false;
CInterProcessMutex mutex(MUTEX_GLOBALBOOKMARKS);
CXmlFile file(wxGetApp().GetSettingsFile(_T("bookmarks")));
TiXmlElement* pDocument = file.Load();
if (!pDocument) {
wxString msg = file.GetError() + _T("\n\n") + _("The bookmark could not be added.");
wxMessageBoxEx(msg, _("Error loading xml file"), wxICON_ERROR);
return false;
}
TiXmlElement *pInsertBefore = 0;
TiXmlElement *pBookmark;
for (pBookmark = pDocument->FirstChildElement("Bookmark"); pBookmark; pBookmark = pBookmark->NextSiblingElement("Bookmark")) {
wxString remote_dir_raw;
wxString old_name = GetTextElement(pBookmark, "Name");
if (!name.CmpNoCase(old_name)) {
wxMessageBoxEx(_("Name of bookmark already exists."), _("New bookmark"), wxICON_EXCLAMATION);
return false;
}
if (name < old_name && !pInsertBefore)
pInsertBefore = pBookmark;
}
if (pInsertBefore)
pBookmark = pDocument->InsertBeforeChild(pInsertBefore, TiXmlElement("Bookmark"))->ToElement();
else
pBookmark = pDocument->LinkEndChild(new TiXmlElement("Bookmark"))->ToElement();
AddTextElement(pBookmark, "Name", name);
if (!local_dir.empty())
AddTextElement(pBookmark, "LocalDir", local_dir);
if (!remote_dir.empty())
AddTextElement(pBookmark, "RemoteDir", remote_dir.GetSafePath());
if (sync)
AddTextElementRaw(pBookmark, "SyncBrowsing", "1");
if (!file.Save(false)) {
wxString msg = wxString::Format(_("Could not write \"%s\", the bookmark could not be added: %s"), file.GetFileName(), file.GetError());
wxMessageBoxEx(msg, _("Error writing xml file"), wxICON_ERROR);
return false;
}
return true;
}
示例2:
CFolderScanItem::CFolderScanItem(CServerItem* parent, bool queued, bool download, const wxString& localPath, const CServerPath& remotePath)
{
m_parent = parent;
m_download = download;
m_localPath = localPath;
m_remotePath = remotePath;
m_queued = queued;
m_remove = false;
m_active = false;
m_count = 0;
t_dirPair pair;
pair.localPath = localPath.c_str();
pair.remotePath.SetSafePath(remotePath.GetSafePath().c_str());
m_dirsToCheck.push_back(pair);
m_defaultFileExistsAction = CFileExistsNotification::unknown;
}
示例3: Connect
bool CState::Connect(const CServer& server, bool askBreak, const CServerPath& path /*=CServerPath()*/)
{
if (!m_pEngine)
return false;
if (m_pEngine->IsConnected() || m_pEngine->IsBusy() || !m_pCommandQueue->Idle())
{
if (askBreak)
if (wxMessageBox(_("Break current connection?"), _T("FileZilla"), wxYES_NO | wxICON_QUESTION) != wxYES)
return false;
m_pCommandQueue->Cancel();
}
m_pCommandQueue->ProcessCommand(new CConnectCommand(server));
m_pCommandQueue->ProcessCommand(new CListCommand(path));
COptions::Get()->SetLastServer(server);
COptions::Get()->SetOption(OPTION_LASTSERVERPATH, path.GetSafePath());
m_pMainFrame->SetTitle(server.FormatServer() + _T(" - FileZilla"));
return true;
}
示例4: while
int64_t CQueueStorage::Impl::SaveRemotePath(const CServerPath& path)
{
wxString const& safePath = path.GetSafePath();
std::unordered_map<wxString, int64_t, wxStringHash>::const_iterator it = remotePaths_.find(safePath);
if (it != remotePaths_.end())
return it->second;
Bind(insertRemotePathQuery_, path_table_column_names::path, safePath);
int res;
do {
res = sqlite3_step(insertRemotePathQuery_);
} while (res == SQLITE_BUSY);
sqlite3_reset(insertRemotePathQuery_);
if (res == SQLITE_DONE) {
int64_t id = sqlite3_last_insert_rowid(db_);
remotePaths_[safePath] = id;
return id;
}
return -1;
}
示例5: AddBookmark
bool CSiteManager::AddBookmark(wxString sitePath, const wxString& name, const wxString &local_dir, const CServerPath &remote_dir, bool sync)
{
if (local_dir.empty() && remote_dir.IsEmpty())
return false;
if (sitePath[0] != '0')
return false;
sitePath = sitePath.Mid(1);
// We have to synchronize access to sitemanager.xml so that multiple processed don't write
// to the same file or one is reading while the other one writes.
CInterProcessMutex mutex(MUTEX_SITEMANAGER);
CXmlFile file;
TiXmlElement* pDocument = file.Load(_T("sitemanager"));
if (!pDocument)
{
wxString msg = file.GetError() + _T("\n") + _("The bookmark could not be added.");
wxMessageBox(msg, _("Error loading xml file"), wxICON_ERROR);
return false;
}
TiXmlElement* pElement = pDocument->FirstChildElement("Servers");
if (!pElement)
return false;
std::list<wxString> segments;
if (!UnescapeSitePath(sitePath, segments))
{
wxMessageBox(_("Site path is malformed."), _("Invalid site path"));
return 0;
}
TiXmlElement* pChild = GetElementByPath(pElement, segments);
if (!pChild || strcmp(pChild->Value(), "Server"))
{
wxMessageBox(_("Site does not exist."), _("Invalid site path"));
return 0;
}
// Bookmarks
TiXmlElement *pInsertBefore = 0;
TiXmlElement* pBookmark;
for (pBookmark = pChild->FirstChildElement("Bookmark"); pBookmark; pBookmark = pBookmark->NextSiblingElement("Bookmark"))
{
TiXmlHandle handle(pBookmark);
wxString old_name = GetTextElement_Trimmed(pBookmark, "Name");
if (old_name.empty())
continue;
if (name == old_name)
{
wxMessageBox(_("Name of bookmark already exists."), _("New bookmark"), wxICON_EXCLAMATION);
return false;
}
if (name < old_name && !pInsertBefore)
pInsertBefore = pBookmark;
}
if (pInsertBefore)
pBookmark = pChild->InsertBeforeChild(pInsertBefore, TiXmlElement("Bookmark"))->ToElement();
else
pBookmark = pChild->LinkEndChild(new TiXmlElement("Bookmark"))->ToElement();
AddTextElement(pBookmark, "Name", name);
if (!local_dir.empty())
AddTextElement(pBookmark, "LocalDir", local_dir);
if (!remote_dir.IsEmpty())
AddTextElement(pBookmark, "RemoteDir", remote_dir.GetSafePath());
if (sync)
AddTextElementRaw(pBookmark, "SyncBrowsing", "1");
wxString error;
if (!file.Save(&error))
{
if (COptions::Get()->GetOptionVal(OPTION_DEFAULT_KIOSKMODE) == 2)
return true;
wxString msg = wxString::Format(_("Could not write \"%s\", the selected sites could not be exported: %s"), file.GetFileName().GetFullPath().c_str(), error.c_str());
wxMessageBox(msg, _("Error writing xml file"), wxICON_ERROR);
}
return true;
}