本文整理汇总了C++中wxFileName::Exists方法的典型用法代码示例。如果您正苦于以下问题:C++ wxFileName::Exists方法的具体用法?C++ wxFileName::Exists怎么用?C++ wxFileName::Exists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxFileName
的用法示例。
在下文中一共展示了wxFileName::Exists方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DiffNew
void DiffSideBySidePanel::DiffNew(const wxFileName& left, const wxFileName& right)
{
if(!left.Exists()) {
::wxMessageBox(wxString() << _("Left Side File:\n") << left.GetFullPath() << _(" does not exist!"), "CodeLite",
wxICON_ERROR | wxCENTER | wxOK);
return;
}
if(!right.Exists()) {
::wxMessageBox(wxString() << _("Right Side File:\n") << right.GetFullPath() << _(" does not exist!"),
"CodeLite", wxICON_ERROR | wxCENTER | wxOK);
return;
}
m_staticTextLeft->Hide();
m_staticTextRight->Hide();
m_flags = kSavePaths; // store the paths on exit
m_config.SetViewMode(DiffConfig::kViewVerticalSplit);
m_splitter->Unsplit();
m_splitter->SplitVertically(m_splitterPageLeft, m_splitterPageRight);
// Restore last used paths
m_config.Load();
m_textCtrlLeftFile->ChangeValue(left.GetFullPath());
m_textCtrlRightFile->ChangeValue(right.GetFullPath());
CallAfter(&DiffSideBySidePanel::Diff); // trigger a diff
}
示例2: Write
void clSFTP::Write(const wxFileName& localFile, const wxString& remotePath) throw(clException)
{
if(!m_connected) {
throw clException("scp is not initialized!");
}
if(!localFile.Exists()) {
throw clException(wxString() << "scp::Write file '" << localFile.GetFullPath() << "' does not exist!");
}
wxFFile fp(localFile.GetFullPath(), "rb");
if(!fp.IsOpened()) {
throw clException(wxString() << "scp::Write could not open file '" << localFile.GetFullPath() << "'. "
<< ::strerror(errno));
}
char buffer[4096];
wxMemoryBuffer memBuffer;
size_t nbytes(0);
while(!fp.Eof()) {
nbytes = fp.Read(buffer, sizeof(buffer));
if(nbytes == 0) break;
memBuffer.AppendData(buffer, nbytes);
}
fp.Close();
Write(memBuffer, remotePath);
}
示例3: ExistsCMakeLists
bool CMakePlugin::ExistsCMakeLists(wxFileName directory) const
{
// Add CMakeLists.txt
directory.SetFullName(CMAKELISTS_FILE);
return directory.Exists();
}
示例4: StoreWorkspaceSession
void PluginManager::StoreWorkspaceSession(const wxFileName& workspaceFile)
{
if(workspaceFile.Exists()) {
SessionEntry session;
clMainFrame::Get()->GetMainBook()->CreateSession(session);
session.SetWorkspaceName(workspaceFile.GetFullPath());
SessionManager::Get().Save(session.GetWorkspaceName(), session);
}
}
示例5: Create
bool NodeJSWorkspace::Create(const wxFileName& filename)
{
if(IsOpen()) return false;
if(filename.Exists()) return false;
DoClear();
m_filename = filename;
// By default add the workspace path
m_folders.Add(m_filename.GetPath());
Save();
// We dont load the workspace
DoClear();
return true;
}
示例6: LoadProject
void KICAD_MANAGER_FRAME::LoadProject( const wxFileName& aProjectFileName )
{
// The project file should be valid by the time we get here or something has gone wrong.
if( !aProjectFileName.Exists() )
return;
// Any open KIFACE's must be closed if they are not part of the new project.
// (We never want a KIWAY_PLAYER open on a KIWAY that isn't in the same project.)
// User is prompted here to close those KIWAY_PLAYERs:
if( !Kiway().PlayersClose( false ) )
return;
SetTitle( wxString( "KiCad " ) + GetBuildVersion() );
// Save the project file for the currently loaded project.
if( m_active_project )
Prj().ConfigLoad( PgmTop().SysSearch(), GeneralGroupName, s_KicadManagerParams );
m_active_project = true;
ClearMsg();
SetProjectFileName( aProjectFileName.GetFullPath() );
Prj().ConfigLoad( PgmTop().SysSearch(), GeneralGroupName, s_KicadManagerParams );
wxString title = GetTitle() + " " + aProjectFileName.GetFullPath();
if( !aProjectFileName.IsDirWritable() )
title += _( " [Read Only]" );
else
SetMruPath( Prj().GetProjectPath() ); // Only set MRU path if we have write access. Why?
SetTitle( title );
UpdateFileHistory( aProjectFileName.GetFullPath(), &PgmTop().GetFileHistory() );
m_LeftWin->ReCreateTreePrj();
// Rebuild the list of watched paths.
// however this is possible only when the main loop event handler is running,
// so we use it to run the rebuild function.
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED, ID_INIT_WATCHED_PATHS );
wxPostEvent( this, cmd );
PrintPrjInfo();
}
示例7: ConvertCodeLiteCompilationDatabaseToCMake
wxFileName CompilationDatabase::ConvertCodeLiteCompilationDatabaseToCMake(const wxFileName& compile_file)
{
wxFFile fp(compile_file.GetFullPath(), wxT("rb"));
if( fp.IsOpened() ) {
wxString content;
fp.ReadAll(&content, wxConvUTF8);
if( content.IsEmpty() )
return wxFileName();
JSONRoot root(cJSON_Array);
JSONElement arr = root.toElement();
wxArrayString lines = ::wxStringTokenize(content, "\n\r", wxTOKEN_STRTOK);
for(size_t i=0; i<lines.GetCount(); ++i) {
wxArrayString parts = ::wxStringTokenize(lines.Item(i), wxT("|"), wxTOKEN_STRTOK);
if( parts.GetCount() != 3 )
continue;
wxString file_name = wxFileName(parts.Item(0).Trim().Trim(false)).GetFullPath();
wxString cwd = parts.Item(1).Trim().Trim(false);
wxString cmp_flags = parts.Item(2).Trim().Trim(false);
JSONElement element = JSONElement::createObject();
element.addProperty("directory", cwd);
element.addProperty("command", cmp_flags);
element.addProperty("file", file_name);
arr.arrayAppend( element );
}
wxFileName fn(compile_file.GetPath(), "compile_commands.json");
root.save( fn );
// Delete the old file
{
wxLogNull nl;
fp.Close();
if ( compile_file.Exists() ) {
::wxRemoveFile( compile_file.GetFullPath() );
}
}
return fn;
}
return wxFileName();
}
示例8: Write
void clSFTP::Write(const wxFileName& localFile, const wxString& remotePath) throw (clException)
{
if ( !m_connected ) {
throw clException("scp is not initialized!");
}
if ( !localFile.Exists() ) {
throw clException(wxString() << "scp::Write file '" << localFile.GetFullPath() << "' does not exist!");
}
wxFFile fp(localFile.GetFullPath(), "rb");
if ( !fp.IsOpened() ) {
throw clException(wxString() << "scp::Write could not open file '" << localFile.GetFullPath() << "'. " << ::strerror(errno) );
}
wxString fileContent;
fp.ReadAll(&fileContent);
Write(fileContent, remotePath);
}
示例9: AddWorkspaceToRecentlyUsedList
void PluginManager::AddWorkspaceToRecentlyUsedList(const wxFileName& filename)
{
if(filename.Exists()) {
ManagerST::Get()->AddToRecentlyOpenedWorkspaces(filename.GetFullPath());
}
}