\latexignore{\rtfignore{\wxheading{Members}}}
+
\membersection{wxFileSystem::wxFileSystem}\label{wxfilesystemwxfilesystem}
\func{}{wxFileSystem}{\void}
Constructor.
+
\membersection{wxFileSystem::AddHandler}\label{wxfilesystemaddhandler}
\func{static void}{AddHandler}{\param{wxFileSystemHandler }{*handler}}
are deleted in wxFileSystem's destructor so that you don't have to
care about it.
+
\membersection{wxFileSystem::ChangePathTo}\label{wxfilesystemchangepathto}
\func{void}{ChangePathTo}{\param{const wxString\& }{location}, \param{bool }{is\_dir = false}}
f = fs -> OpenFile("hello.htm"); // opens file 'subdir/folder/hello.htm' !!
\end{verbatim}
+
\membersection{wxFileSystem::GetPath}\label{wxfilesystemgetpath}
\func{wxString}{GetPath}{\void}
Returns actual path (set by \helpref{ChangePathTo}{wxfilesystemchangepathto}).
+
\membersection{wxFileSystem::FileNameToURL}\label{wxfilesystemfilenametourl}
\func{static wxString}{FileNameToURL}{\param{wxFileName }{filename}}
\helpref{wxFileSystem::URLToFileName}{wxfilesystemurltofilename},
\helpref{wxFileName}{wxfilename}
+
+\membersection{wxFileSystem::FindFileInPath}\label{wxfilesystemfindfileinpath}
+
+\func{bool}{FindFileInPath}{\param{wxString }{*str}, \param{const wxChar }{*path}, \param{const wxChar }{*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
+\arg{path}. If the file is found in any directory, returns \true and the full
+path of the file in \arg{str}, otherwise returns \false and doesn't modify
+\arg{str}.
+
+\wxheading{Parameters}
+
+\docparam{str}{Receives the full path of the file, must not be \NULL}
+
+\docparam{path}{\texttt{wxPATH\_SEP}-separated list of directories}
+
+\docparam{file}{the name of the file to look for}
+
+
\membersection{wxFileSystem::FindFirst}\label{wxfilesystemfindfirst}
\func{wxString}{FindFirst}{\param{const wxString\& }{wildcard}, \param{int }{flags = 0}}
filename (within filesystem's current path) that matches {\it wildcard}. {\it flags} may be one of
wxFILE (only files), wxDIR (only directories) or 0 (both).
+
\membersection{wxFileSystem::FindNext}\label{wxfilesystemfindnext}
\func{wxString}{FindNext}{\void}
Returns the next filename that matches parameters passed to \helpref{FindFirst}{wxfilesystemfindfirst}.
+
\membersection{wxFileSystem::OpenFile}\label{wxfilesystemopenfile}
\func{wxFSFile*}{OpenFile}{\param{const wxString\& }{location}}
absolute path. Note that the user is responsible for deleting the returned
wxFSFile.
+
\membersection{wxFileSystem::URLToFileName}\label{wxfilesystemurltofilename}
\func{static wxFileName}{URLToFileName}{\param{const wxString\& }{url}}
#include "wx/module.h"
#include "wx/mimetype.h"
#include "wx/filename.h"
+#include "wx/tokenzr.h"
//--------------------------------------------------------------------------------
else return m_FindFileHandler -> FindNext();
}
+bool wxFileSystem::FindFileInPath(wxString *pStr,
+ const wxChar *path,
+ const wxChar *basename)
+{
+ // we assume that it's not empty
+ wxCHECK_MSG( !wxIsEmpty(basename), false,
+ _T("empty file name in wxFileSystem::FindFileInPath"));
+
+ // skip path separator in the beginning of the file name if present
+ if ( wxIsPathSeparator(*basename) )
+ basename++;
+
+ wxStringTokenizer tokenizer(path, wxPATH_SEP);
+ while ( tokenizer.HasMoreTokens() )
+ {
+ wxString strFile = tokenizer.GetNextToken();
+ if ( !wxEndsWithPathSeparator(strFile) )
+ strFile += wxFILE_SEP_PATH;
+ strFile += basename;
+
+ wxFSFile *file = OpenFile(strFile);
+ if ( file )
+ {
+ delete file;
+ *pStr = strFile;
+ return true;
+ }
+ }
+ return false;
+}
void wxFileSystem::AddHandler(wxFileSystemHandler *handler)
{