X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b838cfc9151aea38402ad2b1ba5d2f97cf94e973..0ded6bb695f82a0b98d0862ec6870fc5c6cb8b97:/src/common/filesys.cpp?ds=sidebyside diff --git a/src/common/filesys.cpp b/src/common/filesys.cpp index d154b75f73..f350965e66 100644 --- a/src/common/filesys.cpp +++ b/src/common/filesys.cpp @@ -24,7 +24,7 @@ #include "wx/module.h" #include "wx/filesys.h" #include "wx/mimetype.h" - +#include "wx/filename.h" @@ -138,15 +138,8 @@ wxString wxFileSystemHandler::FindNext() // wxLocalFSHandler //-------------------------------------------------------------------------------- -class wxLocalFSHandler : public wxFileSystemHandler -{ - public: - virtual bool CanOpen(const wxString& location); - virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location); - virtual wxString FindFirst(const wxString& spec, int flags = 0); - virtual wxString FindNext(); -}; +wxString wxLocalFSHandler::ms_root; bool wxLocalFSHandler::CanOpen(const wxString& location) { @@ -155,33 +148,24 @@ bool wxLocalFSHandler::CanOpen(const wxString& location) wxFSFile* wxLocalFSHandler::OpenFile(wxFileSystem& WXUNUSED(fs), const wxString& location) { - wxString right = GetRightLocation(location); - #ifdef __WXMAC__ - if ( right[0] != '.' && right[0] != '/' && right.Find( '/' ) != wxNOT_FOUND ) { - right = "./" + right ; - } - right = wxUnix2MacFilename( right ) ; - #endif - if (!wxFileExists(right)) + // location has Unix path separators + wxString right = ms_root + GetRightLocation(location); + wxFileName fn(right, wxPATH_UNIX); + + if (!wxFileExists(fn.GetFullPath())) return (wxFSFile*) NULL; - - return new wxFSFile(new wxFileInputStream(right), + + return new wxFSFile(new wxFileInputStream(fn.GetFullPath()), right, GetMimeTypeFromExt(location), GetAnchor(location), - wxDateTime(wxFileModificationTime(right))); + wxDateTime(wxFileModificationTime(fn.GetFullPath()))); } wxString wxLocalFSHandler::FindFirst(const wxString& spec, int flags) { - wxString right = GetRightLocation(spec); - #ifdef __WXMAC__ - if ( right[0] != '.' && right[0] != '/' && right.Find( '/' ) != wxNOT_FOUND ) { - right = "./" + right ; - } - right = wxUnix2MacFilename( right ) ; - #endif + wxString right = ms_root + GetRightLocation(spec); return wxFindFirstFile(right, flags); }