Recognize UNCs starting with forward slashes too in wxFileName.
Treat \\share\path and //share/path in the same way (for wxPATH_DOS paths). Add a test for UNC parsing to the unit test. Closes #11376. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62561 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -144,6 +144,8 @@
|
||||
extern const wxULongLong wxInvalidSize = (unsigned)-1;
|
||||
#endif // wxUSE_LONGLONG
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// private classes
|
||||
@@ -295,17 +297,26 @@ static wxString wxGetVolumeString(const wxString& volume, wxPathFormat format)
|
||||
return path;
|
||||
}
|
||||
|
||||
// return true if the character is a DOS path separator i.e. either a slash or
|
||||
// a backslash
|
||||
inline bool IsDOSPathSep(wxUniChar ch)
|
||||
{
|
||||
return ch == wxFILE_SEP_PATH_DOS || ch == wxFILE_SEP_PATH_UNIX;
|
||||
}
|
||||
|
||||
// return true if the format used is the DOS/Windows one and the string looks
|
||||
// like a UNC path
|
||||
static bool IsUNCPath(const wxString& path, wxPathFormat format)
|
||||
{
|
||||
return format == wxPATH_DOS &&
|
||||
path.length() >= 4 && // "\\a" can't be a UNC path
|
||||
path[0u] == wxFILE_SEP_PATH_DOS &&
|
||||
path[1u] == wxFILE_SEP_PATH_DOS &&
|
||||
path[2u] != wxFILE_SEP_PATH_DOS;
|
||||
IsDOSPathSep(path[0u]) &&
|
||||
IsDOSPathSep(path[1u]) &&
|
||||
!IsDOSPathSep(path[2u]);
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
Reference in New Issue
Block a user