From 62f833c4aff12cd11cb9b38d3fd75a2761b93937 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Wed, 16 Feb 2011 21:46:49 +0000 Subject: [PATCH] Applied #12438 IsUNCPath patch git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@66915 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/filename.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/common/filename.cpp b/src/common/filename.cpp index e95c16dfaf..5018336e9f 100644 --- a/src/common/filename.cpp +++ b/src/common/filename.cpp @@ -284,15 +284,22 @@ 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(wxChar 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]); } // ============================================================================