]> git.saurik.com Git - wxWidgets.git/commitdiff
use wxString in wxFileSystem::FindFileInPath()
authorVáclav Slavík <vslavik@fastmail.fm>
Tue, 19 Jun 2007 17:39:27 +0000 (17:39 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Tue, 19 Jun 2007 17:39:27 +0000 (17:39 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46544 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/latex/wx/filesys.tex
include/wx/filesys.h
src/common/filesys.cpp

index ddca00a1a2f94fbdb0a5d4d8f9583dd2561a92b9..091c52217453238c1f1344dc99a557d9ec25149f 100644 (file)
@@ -118,7 +118,7 @@ Converts filename into URL.
 
 \membersection{wxFileSystem::FindFileInPath}\label{wxfilesystemfindfileinpath}
 
-\func{bool}{FindFileInPath}{\param{wxString }{*str}, \param{const wxChar }{*path}, \param{const wxChar }{*file}}
+\func{bool}{FindFileInPath}{\param{wxString }{*str}, \param{const wxString\& }{path}, \param{const wxString\& }{file}}
 
 Looks for the file with the given name \arg{file} in a colon or semi-colon
 (depending on the current platform) separated list of directories in
index 686c64ac0c0a7ebc7eb4518e104431c59b3c54a5..02ae931a03de2da180c6f744e9ba8a4e9e02ae3b 100644 (file)
@@ -205,7 +205,8 @@ public:
     wxString FindNext();
 
     // find a file in a list of directories, returns false if not found
-    bool FindFileInPath(wxString *pStr, const wxChar *path, const wxChar *file);
+    bool FindFileInPath(wxString *pStr,
+                        const wxString& path, const wxString& file);
 
     // Adds FS handler.
     // In fact, this class is only front-end to the FS handlers :-)
index 8488c57702c1e87e896e9eb63852a1560314fe2f..7e6044e4c255a17e614a7807b0c1c163daea889b 100644 (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 )