diff --git a/src/google/protobuf/compiler/command_line_interface.cc b/src/google/protobuf/compiler/command_line_interface.cc index 5b4fc1383a..4ae1ba6831 100644 --- a/src/google/protobuf/compiler/command_line_interface.cc +++ b/src/google/protobuf/compiler/command_line_interface.cc @@ -1432,14 +1432,14 @@ CommandLineInterface::InterpretArgument(const std::string& name, #if defined(_WIN32) // On Windows, the shell (typically cmd.exe) does not expand wildcards in // file names (e.g. foo\*.proto), so we do it ourselves. - switch (google::protobuf::internal::win32::expand_wildcards( + switch (google::protobuf::io::win32::expand_wildcards( value, [this](const string& path) { this->input_files_.push_back(path); })) { - case google::protobuf::internal::win32::ExpandWildcardsResult::kSuccess: + case google::protobuf::io::win32::ExpandWildcardsResult::kSuccess: break; - case google::protobuf::internal::win32::ExpandWildcardsResult::kErrorNoMatchingFile: + case google::protobuf::io::win32::ExpandWildcardsResult::kErrorNoMatchingFile: // Path does not exist, is not a file, or it's longer than MAX_PATH and // long path handling is disabled. std::cerr << "Invalid file name pattern or missing input file \"" diff --git a/src/google/protobuf/io/io_win32.cc b/src/google/protobuf/io/io_win32.cc index 59f3ec5c9d..f6ad537427 100755 --- a/src/google/protobuf/io/io_win32.cc +++ b/src/google/protobuf/io/io_win32.cc @@ -362,7 +362,7 @@ wstring testonly_utf8_to_winpath(const char* path) { return as_windows_path(path, &wpath) ? wpath : wstring(); } -bool expand_wildcards( +int expand_wildcards( const string& path, std::function consume) { if (path.find_first_of("*?") == string::npos) { // There are no wildcards in the path, we don't need to expand it. diff --git a/src/google/protobuf/io/io_win32.h b/src/google/protobuf/io/io_win32.h index ae6ed0a66f..6d4362ca93 100755 --- a/src/google/protobuf/io/io_win32.h +++ b/src/google/protobuf/io/io_win32.h @@ -92,12 +92,8 @@ struct ExpandWildcardsResult { // in the last path segment. This function passes all matching file names to // `consume`. The resulting paths may not be absolute nor normalized. // -// The function returns true if the path did not contain any wildcards (in -// which case the path may or may not exist), or the path did contain wildcards -// and it matched at least one file. -// The function returns false if the path contained wildcards but it did not -// match any files. -LIBPROTOBUF_EXPORT bool expand_wildcards( +// The function returns a value from `ExpandWildcardsResult`. +LIBPROTOBUF_EXPORT int expand_wildcards( const std::string& path, std::function consume); namespace strings {