]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/filename.cpp
make wxSocketImplUnix inherit from wxFDIOHandler as they're used for almost the same...
[wxWidgets.git] / src / common / filename.cpp
index 1e3444bc87a029c34158026a7e6be46f01c1cc19..371101a6899d0d7f66c88428b068f58a5cd16ce9 100644 (file)
@@ -1896,19 +1896,21 @@ wxString wxFileName::GetLongPath() const
     size_t count = dirs.GetCount();
     for ( size_t i = 0; i < count; i++ )
     {
+        const wxString& dir = dirs[i];
+
         // We're using pathOut to collect the long-name path, but using a
         // temporary for appending the last path component which may be
         // short-name
-        tmpPath = pathOut + dirs[i];
-
-        if ( tmpPath.empty() )
-            continue;
-
-        // can't see this being necessary? MF
-        if ( tmpPath.Last() == GetVolumeSeparator(wxPATH_DOS) )
+        tmpPath = pathOut + dir;
+
+        // We must not process "." or ".." here as they would be (unexpectedly)
+        // replaced by the corresponding directory names so just leave them
+        // alone
+        //
+        // And we can't pass a drive and root dir to FindFirstFile (VZ: why?)
+        if ( tmpPath.empty() || dir == '.' || dir == ".." ||
+                tmpPath.Last() == GetVolumeSeparator(wxPATH_DOS) )
         {
-            // Can't pass a drive and root dir to FindFirstFile,
-            // so continue to next dir
             tmpPath += wxFILE_SEP_PATH;
             pathOut = tmpPath;
             continue;
@@ -1953,6 +1955,23 @@ wxPathFormat wxFileName::GetFormat( wxPathFormat format )
     return format;
 }
 
+#ifdef wxHAS_FILESYSTEM_VOLUMES
+
+/* static */
+wxString wxFileName::GetVolumeString(char drive, int flags)
+{
+    wxASSERT_MSG( !(flags & ~wxPATH_GET_SEPARATOR), "invalid flag specified" );
+
+    wxString vol(drive);
+    vol += wxFILE_SEP_DSK;
+    if ( flags & wxPATH_GET_SEPARATOR )
+        vol += wxFILE_SEP_PATH;
+
+    return vol;
+}
+
+#endif // wxHAS_FILESYSTEM_VOLUMES
+
 // ----------------------------------------------------------------------------
 // path splitting function
 // ----------------------------------------------------------------------------