]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/filesys.cpp
The mac text ctrl wants '/r' from the log system for line breaks.
[wxWidgets.git] / src / common / filesys.cpp
index ebefb2ef975aae05234b55210e09636b376318f3..197fec89413dbd81b9dcd95772a81a003cbfa669 100644 (file)
 #pragma hdrstop
 #endif
 
-#if !wxUSE_SOCKETS
-    #undef wxUSE_FS_INET
-    #define wxUSE_FS_INET 0
-#endif
 
-#if (wxUSE_HTML || wxUSE_FS_INET || wxUSE_FS_ZIP) && wxUSE_STREAMS
+#if wxUSE_FILESYSTEM
 
 #include "wx/wfstream.h"
 #include "wx/module.h"
@@ -93,14 +89,13 @@ wxString wxFileSystemHandler::GetMimeTypeFromExt(const wxString& location)
     }
 
     ft = wxTheMimeTypesManager -> GetFileTypeFromExtension(ext);
-    if (ft && (ft -> GetMimeType(&mime))) {
-        delete ft; 
-        return mime;
-    }
-    else {
-        delete ft;
-        return wxEmptyString;
+    if ( !ft || !ft -> GetMimeType(&mime) ) {
+        mime = wxEmptyString;
     }
+
+    delete ft;
+
+    return mime;
 }
 
 
@@ -190,13 +185,15 @@ bool wxLocalFSHandler::CanOpen(const wxString& location)
 wxFSFile* wxLocalFSHandler::OpenFile(wxFileSystem& WXUNUSED(fs), const wxString& location)
 {
     wxString right = GetRightLocation(location);
-    if (wxFileExists(right))
-        return new wxFSFile(new wxFileInputStream(right),
-                            right,
-                            GetMimeTypeFromExt(location),
-                            GetAnchor(location),
-                            wxDateTime(wxFileModificationTime(right)));
-    else return (wxFSFile*) NULL;
+    if (!wxFileExists(right))
+        return (wxFSFile*) NULL;
+
+    return new wxFSFile(new wxFileInputStream(right),
+                        right,
+                        GetMimeTypeFromExt(location),
+                        GetAnchor(location),
+                        wxDateTime(wxFileModificationTime(right)));
+
 }
 
 wxString wxLocalFSHandler::FindFirst(const wxString& spec, int flags)
@@ -230,7 +227,7 @@ static wxString MakeCorrectPath(const wxString& path)
     
     cnt = p.Length();
     for (i = 0; i < cnt; i++)
-      if (p.GetChar(i) == wxT('\\')); p.GetWritableChar(i) = wxT('/'); // wanna be windows-safe
+      if (p.GetChar(i) == wxT('\\')) p.GetWritableChar(i) = wxT('/'); // Want to be windows-safe
         
     if (p.Left(2) == wxT("./")) { p = p.Mid(2); cnt -= 2; }
     
@@ -382,7 +379,7 @@ wxString wxFileSystem::FindFirst(const wxString& spec, int flags)
     m_FindFileHandler = NULL;
 
     for (int i = spec2.Length()-1; i >= 0; i--)
-        if (spec2[(unsigned int) i] == wxT('\\')) spec2.GetWritableChar(i) = wxT('/'); // wanna be windows-safe
+        if (spec2[(unsigned int) i] == wxT('\\')) spec2.GetWritableChar(i) = wxT('/'); // Want to be windows-safe
 
     node = m_Handlers.GetFirst();
     while (node)
@@ -451,7 +448,7 @@ class wxFileSystemModule : public wxModule
 IMPLEMENT_DYNAMIC_CLASS(wxFileSystemModule, wxModule)
 
 #endif
-  // (wxUSE_FS_INET || wxUSE_FS_ZIP) && wxUSE_STREAMS
+  // wxUSE_FILESYSTEM