소스 검색

Improve error message regarding proto_path not matching .proto file.

kenton@google.com 16 년 전
부모
커밋
477f799fb6
2개의 변경된 파일10개의 추가작업 그리고 2개의 파일을 삭제
  1. 5 1
      src/google/protobuf/compiler/command_line_interface.cc
  2. 5 1
      src/google/protobuf/compiler/command_line_interface_unittest.cc

+ 5 - 1
src/google/protobuf/compiler/command_line_interface.cc

@@ -439,7 +439,11 @@ bool CommandLineInterface::MakeInputsBeProtoPathRelative(
         } else {
           cerr << input_files_[i] << ": File does not reside within any path "
                   "specified using --proto_path (or -I).  You must specify a "
-                  "--proto_path which encompasses this file." << endl;
+                  "--proto_path which encompasses this file.  Note that the "
+                  "proto_path must be an exact prefix of the .proto file "
+                  "names -- protoc is too dumb to figure out when two paths "
+                  "(e.g. absolute and relative) are equivalent (it's harder "
+                  "than you think)." << endl;
         }
         return false;
     }

+ 5 - 1
src/google/protobuf/compiler/command_line_interface_unittest.cc

@@ -882,7 +882,11 @@ TEST_F(CommandLineInterfaceTest, CwdRelativeInputNotMappedError) {
   ExpectErrorText(
     "$tmpdir/foo.proto: File does not reside within any path "
       "specified using --proto_path (or -I).  You must specify a "
-      "--proto_path which encompasses this file.\n");
+      "--proto_path which encompasses this file.  Note that the "
+      "proto_path must be an exact prefix of the .proto file "
+      "names -- protoc is too dumb to figure out when two paths "
+      "(e.g. absolute and relative) are equivalent (it's harder "
+      "than you think).\n");
 }
 
 TEST_F(CommandLineInterfaceTest, CwdRelativeInputNotFoundAndNotMappedError) {