From bd365871aadca528e03f3b6bb8382a1fdf5f1817 Mon Sep 17 00:00:00 2001 From: Francesco Montorsi Date: Wed, 7 Jan 2009 01:47:47 +0000 Subject: [PATCH] s/wxSplitPath/wxFileName::SplitPath git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57873 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- samples/console/console.cpp | 2 +- src/cocoa/filedlg.mm | 2 +- src/common/docview.cpp | 2 +- src/common/filename.cpp | 2 +- src/common/imagxpm.cpp | 5 +++-- src/generic/filectrlg.cpp | 6 +++--- src/html/helpctrl.cpp | 6 +++--- src/msdos/utilsdos.cpp | 2 +- src/msw/filedlg.cpp | 2 +- src/msw/helpchm.cpp | 2 +- src/msw/helpwin.cpp | 2 +- src/msw/mimetype.cpp | 2 +- src/msw/utils.cpp | 2 +- src/msw/wince/filedlgwce.cpp | 2 +- src/msw/wince/helpwce.cpp | 2 +- src/os2/filedlg.cpp | 10 +++++----- src/osx/cocoa/filedlg.mm | 34 +++++++++++++++++----------------- src/richtext/richtexthtml.cpp | 2 +- utils/wxrc/wxrc.cpp | 4 ++-- 19 files changed, 46 insertions(+), 45 deletions(-) diff --git a/samples/console/console.cpp b/samples/console/console.cpp index 8fb03b8..5fb1832 100644 --- a/samples/console/console.cpp +++ b/samples/console/console.cpp @@ -304,7 +304,7 @@ public: virtual wxDirTraverseResult OnDir(const wxString& dirname) { wxString path, name, ext; - wxSplitPath(dirname, &path, &name, &ext); + wxFileName::SplitPath(dirname, &path, &name, &ext); if ( !ext.empty() ) name << _T('.') << ext; diff --git a/src/cocoa/filedlg.mm b/src/cocoa/filedlg.mm index 57a8a2f..d3d988c 100644 --- a/src/cocoa/filedlg.mm +++ b/src/cocoa/filedlg.mm @@ -189,7 +189,7 @@ void wxFileDialog::GetFilenames(wxArrayString& files) const void wxFileDialog::SetPath(const wxString& path) { wxString ext; - wxSplitPath(path, &m_dir, &m_fileName, &ext); + wxFileName::SplitPath(path, &m_dir, &m_fileName, &ext); if ( !ext.empty() ) m_fileName << _T('.') << ext; } diff --git a/src/common/docview.cpp b/src/common/docview.cpp index b09fc26..11f9b7b 100644 --- a/src/common/docview.cpp +++ b/src/common/docview.cpp @@ -323,7 +323,7 @@ bool wxDocument::SaveAs() wxString fileName(tmp); wxString path, name, ext; - wxSplitPath(fileName, & path, & name, & ext); + wxFileName::SplitPath(fileName, & path, & name, & ext); if (ext.empty()) { diff --git a/src/common/filename.cpp b/src/common/filename.cpp index 7cdc249..508954f 100644 --- a/src/common/filename.cpp +++ b/src/common/filename.cpp @@ -1373,7 +1373,7 @@ bool wxFileName::GetShortcutTarget(const wxString& shortcutPath, wxString* arguments) { wxString path, file, ext; - wxSplitPath(shortcutPath, & path, & file, & ext); + wxFileName::SplitPath(shortcutPath, & path, & file, & ext); HRESULT hres; IShellLink* psl; diff --git a/src/common/imagxpm.cpp b/src/common/imagxpm.cpp index 5aa6dde..3f1caea 100644 --- a/src/common/imagxpm.cpp +++ b/src/common/imagxpm.cpp @@ -80,6 +80,7 @@ license is as follows: #include "wx/imagxpm.h" #include "wx/wfstream.h" #include "wx/xpmdecod.h" +#include "wx/filename.h" IMPLEMENT_DYNAMIC_CLASS(wxXPMHandler,wxImageHandler) @@ -123,8 +124,8 @@ bool wxXPMHandler::SaveFile(wxImage * image, wxString sName; if ( image->HasOption(wxIMAGE_OPTION_FILENAME) ) { - wxSplitPath(image->GetOption(wxIMAGE_OPTION_FILENAME), - NULL, &sName, NULL); + wxFileName::SplitPath(image->GetOption(wxIMAGE_OPTION_FILENAME), + NULL, &sName, NULL); sName << wxT("_xpm"); } diff --git a/src/generic/filectrlg.cpp b/src/generic/filectrlg.cpp index e58ada1..f8b6129 100644 --- a/src/generic/filectrlg.cpp +++ b/src/generic/filectrlg.cpp @@ -193,7 +193,7 @@ void wxFileData::ReadData() m_type |= (fileAttribs & FILE_ATTRIBUTE_DIRECTORY) != 0 ? is_dir : 0; wxString p, f, ext; - wxSplitPath(m_filePath, & p, & f, & ext); + wxFileName::SplitPath(m_filePath, & p, & f, & ext); if (wxStricmp(ext, wxT("exe")) == 0) m_type |= is_exe; @@ -1295,7 +1295,7 @@ void wxGenericFileCtrl::OnSelected( wxListEvent &event ) return; } - + m_ignoreChanges = true; m_text->SetValue( filename ); @@ -1428,7 +1428,7 @@ bool wxGenericFileCtrl::SetPath( const wxString& path ) return false; wxString ext; - wxSplitPath( path, &m_dir, &m_fileName, &ext ); + wxFileName::SplitPath( path, &m_dir, &m_fileName, &ext ); if ( !ext.empty() ) { m_fileName += wxT( "." ); diff --git a/src/html/helpctrl.cpp b/src/html/helpctrl.cpp index 206e868..28e0759 100644 --- a/src/html/helpctrl.cpp +++ b/src/html/helpctrl.cpp @@ -157,7 +157,7 @@ wxHtmlHelpFrame* wxHtmlHelpController::CreateHelpFrame(wxHtmlHelpData *data) wxHtmlHelpFrame* frame = new wxHtmlHelpFrame(data); frame->SetController(this); frame->Create(m_parentWindow, -1, wxEmptyString, m_FrameStyle, m_Config, m_ConfigRoot); - frame->SetTitleFormat(m_titleFormat); + frame->SetTitleFormat(m_titleFormat); m_helpFrame = frame; return frame; } @@ -166,7 +166,7 @@ wxHtmlHelpDialog* wxHtmlHelpController::CreateHelpDialog(wxHtmlHelpData *data) { wxHtmlHelpDialog* dialog = new wxHtmlHelpDialog(data); dialog->SetController(this); - dialog->SetTitleFormat(m_titleFormat); + dialog->SetTitleFormat(m_titleFormat); dialog->Create(m_parentWindow, -1, wxEmptyString, m_FrameStyle); m_helpDialog = dialog; return dialog; @@ -240,7 +240,7 @@ void wxHtmlHelpController::UseConfig(wxConfigBase *config, const wxString& rootp bool wxHtmlHelpController::Initialize(const wxString& file) { wxString dir, filename, ext; - wxSplitPath(file, & dir, & filename, & ext); + wxFileName::SplitPath(file, & dir, & filename, & ext); if (!dir.empty()) dir = dir + wxFILE_SEP_PATH; diff --git a/src/msdos/utilsdos.cpp b/src/msdos/utilsdos.cpp index 93d9b31..d5c8a1a 100644 --- a/src/msdos/utilsdos.cpp +++ b/src/msdos/utilsdos.cpp @@ -200,7 +200,7 @@ const wxChar* wxGetHomeDir(wxString *home) #endif // it needs to be a full path to be usable if ( prog.compare(1, 2, _T(":\\")) == 0 ) - wxSplitPath(prog, &strDir, NULL, NULL); + wxFileName::SplitPath(prog, &strDir, NULL, NULL); } if ( strDir.empty() ) { diff --git a/src/msw/filedlg.cpp b/src/msw/filedlg.cpp index d1bb415..0cc25b1 100644 --- a/src/msw/filedlg.cpp +++ b/src/msw/filedlg.cpp @@ -167,7 +167,7 @@ void wxFileDialog::GetFilenames(wxArrayString& files) const void wxFileDialog::SetPath(const wxString& path) { wxString ext; - wxSplitPath(path, &m_dir, &m_fileName, &ext); + wxFileName::SplitPath(path, &m_dir, &m_fileName, &ext); if ( !ext.empty() ) m_fileName << _T('.') << ext; } diff --git a/src/msw/helpchm.cpp b/src/msw/helpchm.cpp index c991d47..a9c663e 100644 --- a/src/msw/helpchm.cpp +++ b/src/msw/helpchm.cpp @@ -219,7 +219,7 @@ bool wxCHMHelpController::Quit() wxString wxCHMHelpController::GetValidFilename() const { wxString path, name, ext; - wxSplitPath(m_helpFile, &path, &name, &ext); + wxFileName::SplitPath(m_helpFile, &path, &name, &ext); wxString fullName; if (path.IsEmpty()) diff --git a/src/msw/helpwin.cpp b/src/msw/helpwin.cpp index e33ad6c..919c311 100644 --- a/src/msw/helpwin.cpp +++ b/src/msw/helpwin.cpp @@ -112,7 +112,7 @@ bool wxWinHelpController::Quit(void) wxString wxWinHelpController::GetValidFilename(const wxString& file) const { wxString path, name, ext; - wxSplitPath(file, & path, & name, & ext); + wxFileName::SplitPath(file, & path, & name, & ext); wxString fullName; if (path.empty()) diff --git a/src/msw/mimetype.cpp b/src/msw/mimetype.cpp index e10c79b..a7d2911 100644 --- a/src/msw/mimetype.cpp +++ b/src/msw/mimetype.cpp @@ -733,7 +733,7 @@ bool wxFileTypeImpl::SetMimeType(const wxString& mimeTypeOrig) { // make up a default value for it wxString cmd; - wxSplitPath(GetCommand(_T("open")), NULL, &cmd, NULL); + wxFileName::SplitPath(GetCommand(_T("open")), NULL, &cmd, NULL); mimeType << _T("application/x-") << cmd; } else diff --git a/src/msw/utils.cpp b/src/msw/utils.cpp index 3288392..ff23655 100644 --- a/src/msw/utils.cpp +++ b/src/msw/utils.cpp @@ -431,7 +431,7 @@ const wxChar* wxGetHomeDir(wxString *pstr) else // fall back to the program directory { // extract the directory component of the program file name - wxSplitPath(wxGetFullModuleName(), &strDir, NULL, NULL); + wxFileName::SplitPath(wxGetFullModuleName(), &strDir, NULL, NULL); } #endif // UNIX/Win diff --git a/src/msw/wince/filedlgwce.cpp b/src/msw/wince/filedlgwce.cpp index 20dbe03..e5c5940 100644 --- a/src/msw/wince/filedlgwce.cpp +++ b/src/msw/wince/filedlgwce.cpp @@ -105,7 +105,7 @@ void wxFileDialog::GetPaths(wxArrayString& paths) const void wxFileDialog::SetPath(const wxString& path) { wxString ext; - wxSplitPath(path, &m_dir, &m_fileName, &ext); + wxFileName::SplitPath(path, &m_dir, &m_fileName, &ext); if ( !ext.empty() ) m_fileName << _T('.') << ext; } diff --git a/src/msw/wince/helpwce.cpp b/src/msw/wince/helpwce.cpp index 10aed8a..63a9135 100644 --- a/src/msw/wince/helpwce.cpp +++ b/src/msw/wince/helpwce.cpp @@ -90,7 +90,7 @@ bool wxWinceHelpController::Quit() wxString wxWinceHelpController::GetValidFilename(const wxString& file) const { wxString path, name, ext; - wxSplitPath(file, & path, & name, & ext); + wxFileName::SplitPath(file, & path, & name, & ext); wxString fullName; if (path.empty()) diff --git a/src/os2/filedlg.cpp b/src/os2/filedlg.cpp index 77dcc5c..24887d4 100644 --- a/src/os2/filedlg.cpp +++ b/src/os2/filedlg.cpp @@ -248,11 +248,11 @@ int wxFileDialog::ShowModal() int nIdx = wxStrlen(zFileNameBuffer) - 1; wxString sExt; - wxSplitPath( zFileNameBuffer - ,&m_path - ,&m_fileName - ,&sExt - ); + wxFileName::SplitPath( zFileNameBuffer + ,&m_path + ,&m_fileName + ,&sExt + ); if (zFileNameBuffer[nIdx] == wxT('.') || sExt.empty()) { zFileNameBuffer[nIdx] = wxT('\0'); diff --git a/src/osx/cocoa/filedlg.mm b/src/osx/cocoa/filedlg.mm index 3297a33..6d13927 100644 --- a/src/osx/cocoa/filedlg.mm +++ b/src/osx/cocoa/filedlg.mm @@ -55,7 +55,7 @@ NSArray* GetTypesFromFilter( const wxString filter ) { wxArrayString names ; wxArrayString extensions; - + wxString filter2(filter) ; int filterIndex = 0; bool isName = true ; @@ -109,22 +109,22 @@ NSArray* GetTypesFromFilter( const wxString filter ) if (extension.length() && (extension.GetChar(0) == '.')) extension = extension.Mid( 1 ); - if ( extension.IsEmpty() ) + if ( extension.IsEmpty() ) { if ( types != nil ) [types release]; return nil; } - - + + if ( types == nil ) types = [[NSMutableArray alloc] init]; - + wxCFStringRef cfext(extension); [types addObject: (NSString*)cfext.AsNSString() ]; -#if 0 +#if 0 wxUint32 fileType, creator; - + // extension -> mactypes #endif } @@ -135,17 +135,17 @@ NSArray* GetTypesFromFilter( const wxString filter ) int wxFileDialog::ShowModal() { int result = wxID_CANCEL; - + NSSavePanel *panel = nil; - + wxCFStringRef cf( m_message ); - + wxCFStringRef dir( m_path ); wxCFStringRef file( m_fileName ); - + m_path = wxEmptyString; m_fileNames.Clear(); - + if (HasFlag(wxFD_SAVE)) { NSSavePanel* sPanel = [NSSavePanel savePanel]; @@ -153,7 +153,7 @@ int wxFileDialog::ShowModal() [sPanel setCanCreateDirectories:YES]; [sPanel setMessage:cf.AsNSString()]; [sPanel setTreatsFilePackagesAsDirectories:NO]; - + if ( HasFlag(wxFD_OVERWRITE_PROMPT) ) { } @@ -162,7 +162,7 @@ int wxFileDialog::ShowModal() { panel = sPanel; result = wxID_OK; - + wxCFStringRef filename( [[sPanel filename] retain] ); m_path = filename.AsString(); @@ -179,7 +179,7 @@ int wxFileDialog::ShowModal() [oPanel setResolvesAliases:YES]; [oPanel setCanChooseFiles:YES]; [oPanel setMessage:cf.AsNSString()]; - + if ( [oPanel runModalForDirectory:dir.AsNSString() file:file.AsNSString() types:types] == NSOKButton ) { panel = oPanel; @@ -202,7 +202,7 @@ int wxFileDialog::ShowModal() if ( types != nil ) [types release]; } - + return result; } @@ -335,7 +335,7 @@ void wxFileDialog::GetFilenames(wxArrayString& files) const void wxFileDialog::SetPath(const wxString& path) { wxString ext; - wxSplitPath(path, &m_dir, &m_fileName, &ext); + wxFileName::SplitPath(path, &m_dir, &m_fileName, &ext); if ( !ext.empty() ) m_fileName << _T('.') << ext; } diff --git a/src/richtext/richtexthtml.cpp b/src/richtext/richtexthtml.cpp index 2c8694d..301065a 100644 --- a/src/richtext/richtexthtml.cpp +++ b/src/richtext/richtexthtml.cpp @@ -53,7 +53,7 @@ wxRichTextHTMLHandler::wxRichTextHTMLHandler(const wxString& name, const wxStrin bool wxRichTextHTMLHandler::CanHandle(const wxString& filename) const { wxString path, file, ext; - wxSplitPath(filename, & path, & file, & ext); + wxFileName::SplitPath(filename, & path, & file, & ext); return (ext.Lower() == wxT("html") || ext.Lower() == wxT("htm")); } diff --git a/utils/wxrc/wxrc.cpp b/utils/wxrc/wxrc.cpp index 940913e..620e8d0 100644 --- a/utils/wxrc/wxrc.cpp +++ b/utils/wxrc/wxrc.cpp @@ -273,7 +273,7 @@ int XmlResApp::OnRun() wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_MULTIPLE | wxCMD_LINE_OPTION_MANDATORY }, - wxCMD_LINE_DESC_END + wxCMD_LINE_DESC_END }; wxCmdLineParser parser(cmdLineDesc, argc, argv); @@ -416,7 +416,7 @@ wxArrayString XmlResApp::PrepareTempFiles() } wxString name, ext, path; - wxSplitPath(parFiles[i], &path, &name, &ext); + wxFileName::SplitPath(parFiles[i], &path, &name, &ext); FindFilesInXML(doc.GetRoot(), flist, path); if (flagH) -- 2.7.4