本文整理汇总了C++中wxFileName::GetFullPath方法的典型用法代码示例。如果您正苦于以下问题:C++ wxFileName::GetFullPath方法的具体用法?C++ wxFileName::GetFullPath怎么用?C++ wxFileName::GetFullPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxFileName
的用法示例。
在下文中一共展示了wxFileName::GetFullPath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadFileContent
// ----------------------------------------------------------------------------
bool clKeyboardManager::ReadFileContent(const wxFileName& fn, wxString& data, const wxMBConv& conv) //(2019/04/3)
// ----------------------------------------------------------------------------
{
wxString filename = fn.GetFullPath();
wxFFile file(filename, wxT("rb"));
if(file.IsOpened() == false) {
// Nothing to be done
return false;
}
return file.ReadAll(&data, conv);
}
示例2: GetFileSize
size_t FileUtils::GetFileSize(const wxFileName& filename)
{
struct stat b;
wxString file_name = filename.GetFullPath();
const char* cfile = file_name.mb_str(wxConvUTF8).data();
if(::stat(cfile, &b) == 0) {
return b.st_size;
} else {
clERROR() << "Failed to open file:" << file_name << "." << strerror(errno);
return 0;
}
}
示例3: OpenFileExplorerAndSelect
void FileUtils::OpenFileExplorerAndSelect(const wxFileName& filename)
{
#ifdef __WXMSW__
wxString strPath = filename.GetFullPath();
if(strPath.Contains(" ")) { strPath.Prepend("\"").Append("\""); }
wxString cmd;
cmd << "explorer /select," << strPath;
::wxExecute(cmd);
#else
OpenFileExplorer(filename.GetPath());
#endif
}
示例4: wxEvent
t4p::ExplorerModifyEventClass::ExplorerModifyEventClass(int eventId, const wxFileName &oldFile,
const wxString &newName, bool success)
: wxEvent(eventId, t4p::EVENT_EXPLORER_MODIFY)
, OldFile(oldFile.GetFullPath())
, NewName(newName.c_str())
, DirsDeleted()
, FilesDeleted()
, DirsNotDeleted()
, FilesNotDeleted()
, Action(t4p::ExplorerModifyActionClass::RENAME_FILE)
, Success(success) {
}
示例5: wxMakeFileURI
wxString wxMakeFileURI(const wxFileName &fn)
{
wxString path = fn.GetFullPath();
// in case we are using win32 paths with backslashes...
// (this must be done also under Unix since even there we could
// be forced to handle win32 paths)
path.Replace(wxT("\\"), wxT("/"));
// now use wxURI as filter
return wxURI(wxT("file:") + path).BuildURI();
}
示例6: WriteFileContent
bool FileUtils::WriteFileContent(const wxFileName& fn, const wxString& content, const wxMBConv& conv)
{
wxFFile file(fn.GetFullPath(), wxT("w+b"));
if(!file.IsOpened()) {
return false;
}
if(!file.Write(content, conv)) {
return false;
}
return true;
}
示例7: wxExCompareFile
bool wxExCompareFile(const wxFileName& file1, const wxFileName& file2)
{
if (wxConfigBase::Get()->Read(_("Comparator")).empty())
{
return false;
}
const wxString arguments =
(file1.GetModificationTime() < file2.GetModificationTime()) ?
"\"" + file1.GetFullPath() + "\" \"" + file2.GetFullPath() + "\"":
"\"" + file2.GetFullPath() + "\" \"" + file1.GetFullPath() + "\"";
if (wxExecute(wxConfigBase::Get()->Read(_("Comparator")) + " " + arguments) == 0)
{
return false;
}
wxLogStatus(_("Compared") + ": " + arguments);
return true;
}
示例8: SaveTAGS
bool HexEditorCtrl::SaveTAGS( wxFileName flnm ){
if( MainTagArray.Count() == 0){
if( flnm.FileExists() )
wxRemoveFile( flnm.GetFullPath() << wxT(".tags") );
return false;
}
else{
wxXmlDocument doc;
wxXmlNode *node_Root = new wxXmlNode( NULL, wxXML_ELEMENT_NODE, wxT("wxHexEditor_XML_TAG"), wxEmptyString, NULL , NULL);
wxXmlProperty *prop_filename = new wxXmlProperty( wxT("path"), flnm.GetFullPath(), NULL);
wxXmlNode *node_File = new wxXmlNode( node_Root, wxXML_ELEMENT_NODE, wxT("filename"), flnm.GetFullPath(), prop_filename , NULL);
for(unsigned i = 0 ; i < MainTagArray.Count() ; i++ ){
TagElement *TAG = MainTagArray.Item(i);
wxXmlProperty *ID = new wxXmlProperty( wxT("id"), wxString::Format(wxT("%d"),i), NULL );
wxXmlNode *node_Tag = new wxXmlNode( node_File, wxXML_ELEMENT_NODE, wxT("TAG"), wxEmptyString, ID , NULL);
wxXmlNode *element_NoteColour = new wxXmlNode( node_Tag, wxXML_ELEMENT_NODE, wxT("note_colour"), wxEmptyString, NULL, NULL);
new wxXmlNode( element_NoteColour, wxXML_TEXT_NODE, wxT("note_colour"), TAG->NoteClrData.GetColour().GetAsString(wxC2S_HTML_SYNTAX), NULL, NULL);
wxXmlNode *element_FontColour = new wxXmlNode( node_Tag, wxXML_ELEMENT_NODE, wxT("font_colour"), TAG->FontClrData.GetColour().GetAsString(wxC2S_HTML_SYNTAX), NULL, element_NoteColour);
new wxXmlNode( element_FontColour, wxXML_TEXT_NODE, wxT("font_colour"), TAG->FontClrData.GetColour().GetAsString(wxC2S_HTML_SYNTAX), NULL, NULL);
wxXmlNode *element_TagText = new wxXmlNode( node_Tag, wxXML_ELEMENT_NODE, wxT("tag_text"), TAG->tag, NULL, element_FontColour);
new wxXmlNode( element_TagText, wxXML_TEXT_NODE, wxT("tag_text"), TAG->tag, NULL, NULL);
wxXmlNode *element_End = new wxXmlNode( node_Tag, wxXML_ELEMENT_NODE, wxT("end_offset"), wxString::Format(wxT("%ld"),TAG->end ) , NULL, element_TagText);
new wxXmlNode( element_End, wxXML_TEXT_NODE, wxT("end_offset"), wxString::Format(wxT("%ld"),TAG->end ) , NULL, NULL);
wxXmlNode *element_Start = new wxXmlNode( node_Tag, wxXML_ELEMENT_NODE, wxT("start_offset"), wxString::Format(wxT("%ld"), TAG->start ), NULL, element_End);
new wxXmlNode( element_Start, wxXML_TEXT_NODE, wxT("start_offset"), wxString::Format(wxT("%ld"), TAG->start ), NULL, NULL);
}
doc.SetFileEncoding( wxT("UTF-8") );
doc.SetRoot( node_Root );
return doc.Save(flnm.GetFullPath().Append(wxT(".tags")));
}
}
示例9: CreateEmptyFile
bool wxcHelper::CreateEmptyFile( const wxFileName& fn )
{
if ( fn.FileExists() ) {
if ( ::cbMessageBox(_("A file with this name already exists, would you like to replace it?"), wxT("wxCrafter"), wxYES_NO|wxCENTER|wxICON_QUESTION) != wxID_YES ) {
return false;
}
// Remove the current file
if ( !::wxRemoveFile( fn.GetFullPath() ) ) {
return false;
}
}
// Create an empty file
wxFFile fp(fn.GetFullPath(), wxT("w+b"));
if( !fp.IsOpened() ) {
wxString errmsg;
errmsg << _("Failed to create file '") << fn.GetFullPath() << wxT("'");
::wxMessageBox(errmsg, wxT("wxCrafter"), wxICON_ERROR|wxCENTER|wxOK);
return false;
}
return true;
}
示例10: GetFileContents
//////////////////////////////////////////////////////////////////////////////
/// public GetFileContents
/// Get the contents of a file from the server.
///
/// @param file wxFileName What file to get.
/// @param contents wxString & The return value.
///
/// @return bool Whether the call succeeded or not.
///
/// @author David Czechowski @date 04-22-2004
//////////////////////////////////////////////////////////////////////////////
bool Networking::GetFileContents(wxFileName file, wxString &contents)
{
bool success = false;
if(GetStatus() == NET_GOOD) {
if( SSHGetFileContents(file.GetFullPath(wxPATH_UNIX), contents) ) {
m_statusDetails = "";
success = true;
}
}
return success;
}
示例11: GetProjectFromFile
wxString clCxxWorkspace::GetProjectFromFile(const wxFileName& filename) const
{
wxString filenameFP = filename.GetFullPath();
clCxxWorkspace::ProjectMap_t::const_iterator iter = m_projects.begin();
for(; iter != m_projects.end(); ++iter) {
wxStringSet_t allFiles;
iter->second->GetFiles(allFiles);
if(allFiles.count(filenameFP)) {
return iter->first;
}
}
return "";
}
示例12: LoadEntryFromFile
void MainFrame::LoadEntryFromFile(const wxFileName &filename) {
wxProgressDialog progress("Loading", "Now Loading", 4, this,
wxPD_CAN_ABORT | wxPD_AUTO_HIDE | wxPD_APP_MODAL);
auto entry = T::Create(filename, [&progress]() { return progress.Pulse(); });
if (entry == nullptr) {
// wxMessageBox("Failed to load file", "Error", wxICON_ERROR);
return;
}
SetEntry(std::shared_ptr<Entry>(entry));
currentFileCtrl->SetValue(filename.GetFullPath());
}
示例13: RandomName
static wxFileName RandomName(const wxFileName& base, int length = 10)
{
static int ALFA_CNT = 'z' - 'a';
wxString s;
for (int i = 0 ; i < length; ++i)
{
char c = 'a' + (rand() % ALFA_CNT);
s += c;
}
return wxFileName(base.GetFullPath(), s);
}
示例14: AddIncludesFromFile
void CompilerCommandLineParser::AddIncludesFromFile(const wxFileName& includeFile)
{
wxFFile fp( includeFile.GetFullPath(), "rb" );
if ( fp.IsOpened() ) {
wxString content;
fp.ReadAll( &content );
content.Replace("\n", " ");
CompilerCommandLineParser cclp( content );
m_includes.insert(m_includes.end(), cclp.GetIncludes().begin(), cclp.GetIncludes().end());
m_includesWithPrefix.insert(m_includesWithPrefix.end(), cclp.GetIncludesWithPrefix().begin(), cclp.GetIncludesWithPrefix().end());
fp.Close();
}
}
示例15: RenameLocalSymbol
void RefactoringEngine::RenameLocalSymbol(const wxString& symname, const wxFileName& fn, int line, int pos)
{
// Clear previous results
Clear();
// Load the file and get a state map + the text from the scanner
CppWordScanner scanner(fn.GetFullPath());
// get the current file states
TextStatesPtr states = scanner.states();
if( !states ) {
return;
}
// get the local by scanning from the current function's
TagEntryPtr tag = TagsManagerST::Get()->FunctionFromFileLine(fn, line + 1);
if( !tag ) {
return;
}
// Get the line number of the function
int funcLine = tag->GetLine() - 1;
// Convert the line number to offset
int from = states->LineToPos (funcLine);
int to = states->FunctionEndPos(from);
if(to == wxNOT_FOUND)
return;
// search for matches in the given range
CppTokensMap l;
scanner.Match(symname, l, from, to);
CppToken::List_t tokens;
l.findTokens(symname, tokens);
if (tokens.empty())
return;
// Loop over the matches
// Incase we did manage to resolve the word, it means that it is NOT a local variable (DoResolveWord only wors for globals NOT for locals)
RefactorSource target;
std::list<CppToken>::iterator iter = tokens.begin();
for (; iter != tokens.end(); iter++) {
wxFileName f( iter->getFilename() );
if (!DoResolveWord(states, wxFileName(iter->getFilename()), iter->getOffset(), line, symname, &target)) {
m_candidates.push_back( *iter );
}
}
}