From a700fc7aebee4e35dfcc76b245df66cc32bea516 Mon Sep 17 00:00:00 2001 From: Laszlo Csomor Date: Fri, 19 Jul 2019 10:08:46 +0200 Subject: [PATCH] Remove shortpath-related code from ExpandWildcards --- src/google/protobuf/io/io_win32.cc | 36 ------------------------------ 1 file changed, 36 deletions(-) diff --git a/src/google/protobuf/io/io_win32.cc b/src/google/protobuf/io/io_win32.cc index 80e7c4e6cf..5999fac0dd 100755 --- a/src/google/protobuf/io/io_win32.cc +++ b/src/google/protobuf/io/io_win32.cc @@ -370,8 +370,6 @@ ExpandWildcardsResult ExpandWildcards( return ExpandWildcardsResult::kSuccess; } -#ifdef SUPPORT_LONGPATHS - wstring wpath; if (!as_windows_path(path.c_str(), &wpath)) { return ExpandWildcardsResult::kErrorInputPathConversion; @@ -412,40 +410,6 @@ ExpandWildcardsResult ExpandWildcards( } while (::FindNextFileW(handle, &metadata)); FindClose(handle); return matched; - -#else // not SUPPORT_LONGPATHS - - static const string kDot = "."; - static const string kDotDot = ".."; - WIN32_FIND_DATAA metadata; - HANDLE handle = ::FindFirstFileA(path.c_str(), &metadata); - if (handle == INVALID_HANDLE_VALUE) { - // The pattern does not match any files (or directories). - return ExpandWildcardsResult::kErrorNoMatchingFile; - } - - string::size_type pos = path.find_last_of("\\/"); - string dirname; - if (pos != string::npos) { - dirname = path.substr(0, pos + 1); - } - - ExpandWildcardsResult matched = ExpandWildcardsResult::kErrorNoMatchingFile; - do { - // Ignore ".", "..", and directories. - if ((metadata.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0 - && kDot != metadata.cFileName && kDotDot != metadata.cFileName) { - matched = ExpandWildcardsResult::kSuccess; - if (!dirname.empty()) { - consume(dirname + metadata.cFileName); - } else { - consume(metadata.cFileName); - } - } - } while (::FindNextFileA(handle, &metadata)); - FindClose(handle); - return matched; -#endif // SUPPORT_LONGPATHS } namespace strings {