Temporary fix for wxFileName under Mac - ignore volumes.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12862 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -32,7 +32,9 @@
|
|||||||
or just
|
or just
|
||||||
filename
|
filename
|
||||||
(although :filename works as well).
|
(although :filename works as well).
|
||||||
:::file is not yet supported. TODO.
|
:::filename.ext is not yet supported. TODO.
|
||||||
|
Since the volume is just part of the file path, it is not
|
||||||
|
treated like a separate entity as it is done under DOS.
|
||||||
|
|
||||||
wxPATH_VMS: VMS native format, absolute file names have the form
|
wxPATH_VMS: VMS native format, absolute file names have the form
|
||||||
<device>:[dir1.dir2.dir3]file.txt
|
<device>:[dir1.dir2.dir3]file.txt
|
||||||
@@ -868,12 +870,12 @@ wxString wxFileName::GetVolumeSeparator(wxPathFormat format)
|
|||||||
{
|
{
|
||||||
wxString sepVol;
|
wxString sepVol;
|
||||||
|
|
||||||
if ( GetFormat(format) != wxPATH_UNIX )
|
if ( (GetFormat(format) == wxPATH_DOS) ||
|
||||||
|
(GetFormat(format) == wxPATH_VMS) )
|
||||||
{
|
{
|
||||||
// so far it is the same for all systems which have it
|
|
||||||
sepVol = wxFILE_SEP_DSK;
|
sepVol = wxFILE_SEP_DSK;
|
||||||
}
|
}
|
||||||
//else: leave empty, no volume separators under Unix
|
//else: leave empty
|
||||||
|
|
||||||
return sepVol;
|
return sepVol;
|
||||||
}
|
}
|
||||||
@@ -997,17 +999,19 @@ wxString wxFileName::GetFullPath( wxPathFormat format ) const
|
|||||||
// first put the volume
|
// first put the volume
|
||||||
if ( !m_volume.empty() )
|
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
|
// Special Windows UNC paths hack, part 2: undo what we did in
|
||||||
// single letter (hopefully the network shares can't be one letter only
|
// SplitPath() and make an UNC path if we have a drive which is not a
|
||||||
// although I didn't find any authoritative docs on this)
|
// single letter (hopefully the network shares can't be one letter only
|
||||||
if ( format == wxPATH_DOS && m_volume.length() > 1 )
|
// 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;
|
{
|
||||||
}
|
fullpath << wxFILE_SEP_PATH_DOS << wxFILE_SEP_PATH_DOS << m_volume;
|
||||||
else // !UNC
|
}
|
||||||
{
|
else // !UNC
|
||||||
fullpath << m_volume << GetVolumeSeparator(format);
|
{
|
||||||
|
fullpath << m_volume << GetVolumeSeparator(format);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1017,7 +1021,7 @@ wxString wxFileName::GetFullPath( wxPathFormat format ) const
|
|||||||
{
|
{
|
||||||
// under Mac, we must have a path separator in the beginning of the
|
// under Mac, we must have a path separator in the beginning of the
|
||||||
// relative path - otherwise it would be parsed as an absolute one
|
// relative path - otherwise it would be parsed as an absolute one
|
||||||
if ( format == wxPATH_MAC && m_volume.empty() && !m_dirs[0].empty() )
|
if ( format == wxPATH_MAC && m_dirs[0].empty() )
|
||||||
{
|
{
|
||||||
fullpath += wxFILE_SEP_PATH_MAC;
|
fullpath += wxFILE_SEP_PATH_MAC;
|
||||||
}
|
}
|
||||||
@@ -1257,10 +1261,11 @@ void wxFileName::SplitPath(const wxString& fullpathWithVolume,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// do we have the volume name in the beginning?
|
// We separate the volume here
|
||||||
wxString sepVol = GetVolumeSeparator(format);
|
if ( format == wxPATH_DOS || format == wxPATH_VMS )
|
||||||
if ( !sepVol.empty() )
|
|
||||||
{
|
{
|
||||||
|
wxString sepVol = GetVolumeSeparator(format);
|
||||||
|
|
||||||
size_t posFirstColon = fullpath.find_first_of(sepVol);
|
size_t posFirstColon = fullpath.find_first_of(sepVol);
|
||||||
if ( posFirstColon != wxString::npos )
|
if ( posFirstColon != wxString::npos )
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user