]> git.saurik.com Git - wxWidgets.git/commitdiff
fix for splitting the UNC paths
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 7 Apr 2002 22:42:35 +0000 (22:42 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 7 Apr 2002 22:42:35 +0000 (22:42 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15007 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/filename.cpp

index 486f75b109691c5546f070d48dd6ff220a0a9e61..baaf7e0f33f5de51cdc7ec04ad0808869032360a 100644 (file)
@@ -239,6 +239,31 @@ static void ConvertWxToFileTime(FILETIME *ft, const wxDateTime& dt)
 
 #endif // __WIN32__
 
+// return a string with the volume par
+static wxString wxGetVolumeString(const wxString& volume, wxPathFormat format)
+{
+    wxString path;
+
+    if ( !volume.empty() )
+    {
+        // Special Windows UNC paths hack, part 2: undo what we did in
+        // SplitPath() and make an UNC path if we have a drive which is not a
+        // single letter (hopefully the network shares can't be one letter only
+        // although I didn't find any authoritative docs on this)
+        if ( format == wxPATH_DOS && volume.length() > 1 )
+        {
+            path << wxFILE_SEP_PATH_DOS << wxFILE_SEP_PATH_DOS << volume;
+        }
+        else if  ( format == wxPATH_DOS || format == wxPATH_VMS )
+        {
+            path << volume << wxFileName::GetVolumeSeparator(format);
+        }
+        // else ignore
+    }
+
+    return path;
+}
+
 // ============================================================================
 // implementation
 // ============================================================================
@@ -1192,27 +1217,8 @@ wxString wxFileName::GetFullPath( wxPathFormat format ) const
 {
     format = GetFormat(format);
 
-    wxString fullpath;
-
     // first put the volume
-    if ( !m_volume.empty() )
-    {
-        {
-            // Special Windows UNC paths hack, part 2: undo what we did in
-            // SplitPath() and make an UNC path if we have a drive which is not a
-            // single letter (hopefully the network shares can't be one letter only
-            // although I didn't find any authoritative docs on this)
-            if ( format == wxPATH_DOS && m_volume.length() > 1 )
-            {
-                fullpath << wxFILE_SEP_PATH_DOS << wxFILE_SEP_PATH_DOS << m_volume;
-            }
-            else if  ( format == wxPATH_DOS || format == wxPATH_VMS )
-            {
-                fullpath << m_volume << GetVolumeSeparator(format);
-            }
-            // else ignore
-        }
-    }
+    wxString fullpath = wxGetVolumeString(m_volume, format);
 
     // the leading character
     if ( format == wxPATH_MAC )
@@ -1620,9 +1626,9 @@ void wxFileName::SplitPath(const wxString& fullpath,
     wxString volume;
     SplitPath(fullpath, &volume, path, name, ext, format);
 
-    if ( path && !volume.empty() )
+    if ( path )
     {
-        path->Prepend(volume + GetVolumeSeparator(format));
+        path->Prepend(wxGetVolumeString(volume, format));
     }
 }