s/wxSplitPath/wxFileName::SplitPath

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57873 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Francesco Montorsi
2009-01-07 01:47:47 +00:00
parent 47d281e6b7
commit bd365871aa
19 changed files with 46 additions and 45 deletions

View File

@@ -304,7 +304,7 @@ public:
virtual wxDirTraverseResult OnDir(const wxString& dirname) virtual wxDirTraverseResult OnDir(const wxString& dirname)
{ {
wxString path, name, ext; wxString path, name, ext;
wxSplitPath(dirname, &path, &name, &ext); wxFileName::SplitPath(dirname, &path, &name, &ext);
if ( !ext.empty() ) if ( !ext.empty() )
name << _T('.') << ext; name << _T('.') << ext;

View File

@@ -189,7 +189,7 @@ void wxFileDialog::GetFilenames(wxArrayString& files) const
void wxFileDialog::SetPath(const wxString& path) void wxFileDialog::SetPath(const wxString& path)
{ {
wxString ext; wxString ext;
wxSplitPath(path, &m_dir, &m_fileName, &ext); wxFileName::SplitPath(path, &m_dir, &m_fileName, &ext);
if ( !ext.empty() ) if ( !ext.empty() )
m_fileName << _T('.') << ext; m_fileName << _T('.') << ext;
} }

View File

@@ -323,7 +323,7 @@ bool wxDocument::SaveAs()
wxString fileName(tmp); wxString fileName(tmp);
wxString path, name, ext; wxString path, name, ext;
wxSplitPath(fileName, & path, & name, & ext); wxFileName::SplitPath(fileName, & path, & name, & ext);
if (ext.empty()) if (ext.empty())
{ {

View File

@@ -1373,7 +1373,7 @@ bool wxFileName::GetShortcutTarget(const wxString& shortcutPath,
wxString* arguments) wxString* arguments)
{ {
wxString path, file, ext; wxString path, file, ext;
wxSplitPath(shortcutPath, & path, & file, & ext); wxFileName::SplitPath(shortcutPath, & path, & file, & ext);
HRESULT hres; HRESULT hres;
IShellLink* psl; IShellLink* psl;

View File

@@ -80,6 +80,7 @@ license is as follows:
#include "wx/imagxpm.h" #include "wx/imagxpm.h"
#include "wx/wfstream.h" #include "wx/wfstream.h"
#include "wx/xpmdecod.h" #include "wx/xpmdecod.h"
#include "wx/filename.h"
IMPLEMENT_DYNAMIC_CLASS(wxXPMHandler,wxImageHandler) IMPLEMENT_DYNAMIC_CLASS(wxXPMHandler,wxImageHandler)
@@ -123,8 +124,8 @@ bool wxXPMHandler::SaveFile(wxImage * image,
wxString sName; wxString sName;
if ( image->HasOption(wxIMAGE_OPTION_FILENAME) ) if ( image->HasOption(wxIMAGE_OPTION_FILENAME) )
{ {
wxSplitPath(image->GetOption(wxIMAGE_OPTION_FILENAME), wxFileName::SplitPath(image->GetOption(wxIMAGE_OPTION_FILENAME),
NULL, &sName, NULL); NULL, &sName, NULL);
sName << wxT("_xpm"); sName << wxT("_xpm");
} }

View File

@@ -193,7 +193,7 @@ void wxFileData::ReadData()
m_type |= (fileAttribs & FILE_ATTRIBUTE_DIRECTORY) != 0 ? is_dir : 0; m_type |= (fileAttribs & FILE_ATTRIBUTE_DIRECTORY) != 0 ? is_dir : 0;
wxString p, f, ext; wxString p, f, ext;
wxSplitPath(m_filePath, & p, & f, & ext); wxFileName::SplitPath(m_filePath, & p, & f, & ext);
if (wxStricmp(ext, wxT("exe")) == 0) if (wxStricmp(ext, wxT("exe")) == 0)
m_type |= is_exe; m_type |= is_exe;
@@ -1295,7 +1295,7 @@ void wxGenericFileCtrl::OnSelected( wxListEvent &event )
return; return;
} }
m_ignoreChanges = true; m_ignoreChanges = true;
m_text->SetValue( filename ); m_text->SetValue( filename );
@@ -1428,7 +1428,7 @@ bool wxGenericFileCtrl::SetPath( const wxString& path )
return false; return false;
wxString ext; wxString ext;
wxSplitPath( path, &m_dir, &m_fileName, &ext ); wxFileName::SplitPath( path, &m_dir, &m_fileName, &ext );
if ( !ext.empty() ) if ( !ext.empty() )
{ {
m_fileName += wxT( "." ); m_fileName += wxT( "." );

View File

@@ -157,7 +157,7 @@ wxHtmlHelpFrame* wxHtmlHelpController::CreateHelpFrame(wxHtmlHelpData *data)
wxHtmlHelpFrame* frame = new wxHtmlHelpFrame(data); wxHtmlHelpFrame* frame = new wxHtmlHelpFrame(data);
frame->SetController(this); frame->SetController(this);
frame->Create(m_parentWindow, -1, wxEmptyString, m_FrameStyle, m_Config, m_ConfigRoot); frame->Create(m_parentWindow, -1, wxEmptyString, m_FrameStyle, m_Config, m_ConfigRoot);
frame->SetTitleFormat(m_titleFormat); frame->SetTitleFormat(m_titleFormat);
m_helpFrame = frame; m_helpFrame = frame;
return frame; return frame;
} }
@@ -166,7 +166,7 @@ wxHtmlHelpDialog* wxHtmlHelpController::CreateHelpDialog(wxHtmlHelpData *data)
{ {
wxHtmlHelpDialog* dialog = new wxHtmlHelpDialog(data); wxHtmlHelpDialog* dialog = new wxHtmlHelpDialog(data);
dialog->SetController(this); dialog->SetController(this);
dialog->SetTitleFormat(m_titleFormat); dialog->SetTitleFormat(m_titleFormat);
dialog->Create(m_parentWindow, -1, wxEmptyString, m_FrameStyle); dialog->Create(m_parentWindow, -1, wxEmptyString, m_FrameStyle);
m_helpDialog = dialog; m_helpDialog = dialog;
return dialog; return dialog;
@@ -240,7 +240,7 @@ void wxHtmlHelpController::UseConfig(wxConfigBase *config, const wxString& rootp
bool wxHtmlHelpController::Initialize(const wxString& file) bool wxHtmlHelpController::Initialize(const wxString& file)
{ {
wxString dir, filename, ext; wxString dir, filename, ext;
wxSplitPath(file, & dir, & filename, & ext); wxFileName::SplitPath(file, & dir, & filename, & ext);
if (!dir.empty()) if (!dir.empty())
dir = dir + wxFILE_SEP_PATH; dir = dir + wxFILE_SEP_PATH;

View File

@@ -200,7 +200,7 @@ const wxChar* wxGetHomeDir(wxString *home)
#endif #endif
// it needs to be a full path to be usable // it needs to be a full path to be usable
if ( prog.compare(1, 2, _T(":\\")) == 0 ) if ( prog.compare(1, 2, _T(":\\")) == 0 )
wxSplitPath(prog, &strDir, NULL, NULL); wxFileName::SplitPath(prog, &strDir, NULL, NULL);
} }
if ( strDir.empty() ) if ( strDir.empty() )
{ {

View File

@@ -167,7 +167,7 @@ void wxFileDialog::GetFilenames(wxArrayString& files) const
void wxFileDialog::SetPath(const wxString& path) void wxFileDialog::SetPath(const wxString& path)
{ {
wxString ext; wxString ext;
wxSplitPath(path, &m_dir, &m_fileName, &ext); wxFileName::SplitPath(path, &m_dir, &m_fileName, &ext);
if ( !ext.empty() ) if ( !ext.empty() )
m_fileName << _T('.') << ext; m_fileName << _T('.') << ext;
} }

View File

@@ -219,7 +219,7 @@ bool wxCHMHelpController::Quit()
wxString wxCHMHelpController::GetValidFilename() const wxString wxCHMHelpController::GetValidFilename() const
{ {
wxString path, name, ext; wxString path, name, ext;
wxSplitPath(m_helpFile, &path, &name, &ext); wxFileName::SplitPath(m_helpFile, &path, &name, &ext);
wxString fullName; wxString fullName;
if (path.IsEmpty()) if (path.IsEmpty())

View File

@@ -112,7 +112,7 @@ bool wxWinHelpController::Quit(void)
wxString wxWinHelpController::GetValidFilename(const wxString& file) const wxString wxWinHelpController::GetValidFilename(const wxString& file) const
{ {
wxString path, name, ext; wxString path, name, ext;
wxSplitPath(file, & path, & name, & ext); wxFileName::SplitPath(file, & path, & name, & ext);
wxString fullName; wxString fullName;
if (path.empty()) if (path.empty())

View File

@@ -733,7 +733,7 @@ bool wxFileTypeImpl::SetMimeType(const wxString& mimeTypeOrig)
{ {
// make up a default value for it // make up a default value for it
wxString cmd; wxString cmd;
wxSplitPath(GetCommand(_T("open")), NULL, &cmd, NULL); wxFileName::SplitPath(GetCommand(_T("open")), NULL, &cmd, NULL);
mimeType << _T("application/x-") << cmd; mimeType << _T("application/x-") << cmd;
} }
else else

View File

@@ -431,7 +431,7 @@ const wxChar* wxGetHomeDir(wxString *pstr)
else // fall back to the program directory else // fall back to the program directory
{ {
// extract the directory component of the program file name // extract the directory component of the program file name
wxSplitPath(wxGetFullModuleName(), &strDir, NULL, NULL); wxFileName::SplitPath(wxGetFullModuleName(), &strDir, NULL, NULL);
} }
#endif // UNIX/Win #endif // UNIX/Win

View File

@@ -105,7 +105,7 @@ void wxFileDialog::GetPaths(wxArrayString& paths) const
void wxFileDialog::SetPath(const wxString& path) void wxFileDialog::SetPath(const wxString& path)
{ {
wxString ext; wxString ext;
wxSplitPath(path, &m_dir, &m_fileName, &ext); wxFileName::SplitPath(path, &m_dir, &m_fileName, &ext);
if ( !ext.empty() ) if ( !ext.empty() )
m_fileName << _T('.') << ext; m_fileName << _T('.') << ext;
} }

View File

@@ -90,7 +90,7 @@ bool wxWinceHelpController::Quit()
wxString wxWinceHelpController::GetValidFilename(const wxString& file) const wxString wxWinceHelpController::GetValidFilename(const wxString& file) const
{ {
wxString path, name, ext; wxString path, name, ext;
wxSplitPath(file, & path, & name, & ext); wxFileName::SplitPath(file, & path, & name, & ext);
wxString fullName; wxString fullName;
if (path.empty()) if (path.empty())

View File

@@ -248,11 +248,11 @@ int wxFileDialog::ShowModal()
int nIdx = wxStrlen(zFileNameBuffer) - 1; int nIdx = wxStrlen(zFileNameBuffer) - 1;
wxString sExt; wxString sExt;
wxSplitPath( zFileNameBuffer wxFileName::SplitPath( zFileNameBuffer
,&m_path ,&m_path
,&m_fileName ,&m_fileName
,&sExt ,&sExt
); );
if (zFileNameBuffer[nIdx] == wxT('.') || sExt.empty()) if (zFileNameBuffer[nIdx] == wxT('.') || sExt.empty())
{ {
zFileNameBuffer[nIdx] = wxT('\0'); zFileNameBuffer[nIdx] = wxT('\0');

View File

@@ -55,7 +55,7 @@ NSArray* GetTypesFromFilter( const wxString filter )
{ {
wxArrayString names ; wxArrayString names ;
wxArrayString extensions; wxArrayString extensions;
wxString filter2(filter) ; wxString filter2(filter) ;
int filterIndex = 0; int filterIndex = 0;
bool isName = true ; bool isName = true ;
@@ -109,22 +109,22 @@ NSArray* GetTypesFromFilter( const wxString filter )
if (extension.length() && (extension.GetChar(0) == '.')) if (extension.length() && (extension.GetChar(0) == '.'))
extension = extension.Mid( 1 ); extension = extension.Mid( 1 );
if ( extension.IsEmpty() ) if ( extension.IsEmpty() )
{ {
if ( types != nil ) if ( types != nil )
[types release]; [types release];
return nil; return nil;
} }
if ( types == nil ) if ( types == nil )
types = [[NSMutableArray alloc] init]; types = [[NSMutableArray alloc] init];
wxCFStringRef cfext(extension); wxCFStringRef cfext(extension);
[types addObject: (NSString*)cfext.AsNSString() ]; [types addObject: (NSString*)cfext.AsNSString() ];
#if 0 #if 0
wxUint32 fileType, creator; wxUint32 fileType, creator;
// extension -> mactypes // extension -> mactypes
#endif #endif
} }
@@ -135,17 +135,17 @@ NSArray* GetTypesFromFilter( const wxString filter )
int wxFileDialog::ShowModal() int wxFileDialog::ShowModal()
{ {
int result = wxID_CANCEL; int result = wxID_CANCEL;
NSSavePanel *panel = nil; NSSavePanel *panel = nil;
wxCFStringRef cf( m_message ); wxCFStringRef cf( m_message );
wxCFStringRef dir( m_path ); wxCFStringRef dir( m_path );
wxCFStringRef file( m_fileName ); wxCFStringRef file( m_fileName );
m_path = wxEmptyString; m_path = wxEmptyString;
m_fileNames.Clear(); m_fileNames.Clear();
if (HasFlag(wxFD_SAVE)) if (HasFlag(wxFD_SAVE))
{ {
NSSavePanel* sPanel = [NSSavePanel savePanel]; NSSavePanel* sPanel = [NSSavePanel savePanel];
@@ -153,7 +153,7 @@ int wxFileDialog::ShowModal()
[sPanel setCanCreateDirectories:YES]; [sPanel setCanCreateDirectories:YES];
[sPanel setMessage:cf.AsNSString()]; [sPanel setMessage:cf.AsNSString()];
[sPanel setTreatsFilePackagesAsDirectories:NO]; [sPanel setTreatsFilePackagesAsDirectories:NO];
if ( HasFlag(wxFD_OVERWRITE_PROMPT) ) if ( HasFlag(wxFD_OVERWRITE_PROMPT) )
{ {
} }
@@ -162,7 +162,7 @@ int wxFileDialog::ShowModal()
{ {
panel = sPanel; panel = sPanel;
result = wxID_OK; result = wxID_OK;
wxCFStringRef filename( [[sPanel filename] retain] ); wxCFStringRef filename( [[sPanel filename] retain] );
m_path = filename.AsString(); m_path = filename.AsString();
@@ -179,7 +179,7 @@ int wxFileDialog::ShowModal()
[oPanel setResolvesAliases:YES]; [oPanel setResolvesAliases:YES];
[oPanel setCanChooseFiles:YES]; [oPanel setCanChooseFiles:YES];
[oPanel setMessage:cf.AsNSString()]; [oPanel setMessage:cf.AsNSString()];
if ( [oPanel runModalForDirectory:dir.AsNSString() file:file.AsNSString() types:types] == NSOKButton ) if ( [oPanel runModalForDirectory:dir.AsNSString() file:file.AsNSString() types:types] == NSOKButton )
{ {
panel = oPanel; panel = oPanel;
@@ -202,7 +202,7 @@ int wxFileDialog::ShowModal()
if ( types != nil ) if ( types != nil )
[types release]; [types release];
} }
return result; return result;
} }
@@ -335,7 +335,7 @@ void wxFileDialog::GetFilenames(wxArrayString& files) const
void wxFileDialog::SetPath(const wxString& path) void wxFileDialog::SetPath(const wxString& path)
{ {
wxString ext; wxString ext;
wxSplitPath(path, &m_dir, &m_fileName, &ext); wxFileName::SplitPath(path, &m_dir, &m_fileName, &ext);
if ( !ext.empty() ) if ( !ext.empty() )
m_fileName << _T('.') << ext; m_fileName << _T('.') << ext;
} }

View File

@@ -53,7 +53,7 @@ wxRichTextHTMLHandler::wxRichTextHTMLHandler(const wxString& name, const wxStrin
bool wxRichTextHTMLHandler::CanHandle(const wxString& filename) const bool wxRichTextHTMLHandler::CanHandle(const wxString& filename) const
{ {
wxString path, file, ext; wxString path, file, ext;
wxSplitPath(filename, & path, & file, & ext); wxFileName::SplitPath(filename, & path, & file, & ext);
return (ext.Lower() == wxT("html") || ext.Lower() == wxT("htm")); return (ext.Lower() == wxT("html") || ext.Lower() == wxT("htm"));
} }

View File

@@ -273,7 +273,7 @@ int XmlResApp::OnRun()
wxCMD_LINE_VAL_STRING, wxCMD_LINE_VAL_STRING,
wxCMD_LINE_PARAM_MULTIPLE | wxCMD_LINE_OPTION_MANDATORY }, wxCMD_LINE_PARAM_MULTIPLE | wxCMD_LINE_OPTION_MANDATORY },
wxCMD_LINE_DESC_END wxCMD_LINE_DESC_END
}; };
wxCmdLineParser parser(cmdLineDesc, argc, argv); wxCmdLineParser parser(cmdLineDesc, argc, argv);
@@ -416,7 +416,7 @@ wxArrayString XmlResApp::PrepareTempFiles()
} }
wxString name, ext, path; wxString name, ext, path;
wxSplitPath(parFiles[i], &path, &name, &ext); wxFileName::SplitPath(parFiles[i], &path, &name, &ext);
FindFilesInXML(doc.GetRoot(), flist, path); FindFilesInXML(doc.GetRoot(), flist, path);
if (flagH) if (flagH)