use wxString in wxFileSystem::FindFileInPath()

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46544 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2007-06-19 17:39:27 +00:00
parent cb296f303e
commit 593177c566
3 changed files with 12 additions and 8 deletions

View File

@@ -518,16 +518,19 @@ wxString wxFileSystem::FindNext()
}
bool wxFileSystem::FindFileInPath(wxString *pStr,
const wxChar *path,
const wxChar *basename)
const wxString& path,
const wxString& basename)
{
// we assume that it's not empty
wxCHECK_MSG( !wxIsEmpty(basename), false,
wxCHECK_MSG( !basename.empty(), false,
_T("empty file name in wxFileSystem::FindFileInPath"));
wxString name;
// skip path separator in the beginning of the file name if present
if ( wxIsPathSeparator(*basename) )
basename++;
if ( wxIsPathSeparator(basename[0u]) )
name = basename.substr(1);
else
name = basename;
wxStringTokenizer tokenizer(path, wxPATH_SEP);
while ( tokenizer.HasMoreTokens() )
@@ -535,7 +538,7 @@ bool wxFileSystem::FindFileInPath(wxString *pStr,
wxString strFile = tokenizer.GetNextToken();
if ( !wxEndsWithPathSeparator(strFile) )
strFile += wxFILE_SEP_PATH;
strFile += basename;
strFile += name;
wxFSFile *file = OpenFile(strFile);
if ( file )