Search code examples
dartprotocol-buffersprototypeproto

Could not make proto path relative and No such file or directory


go-dev
 -blog
  -blog-server
  -blogpb
    - blog.proto
 -other 
 -dart

i have a directory like that on my project blogpb is the directory where i create .proto file to dart directory, when i run this command:

 protoc -I=. --dart_out=$DST_DIR $SRC_DIR/blogpb/blog.proto  
 // got : Could not make proto path relative: /blogpb/blog.proto: No such file or directory

 protoc --dart_out=grpc:lib/src/generated -Iprotos greet/greetpb/greet.proto
 // got : protos: warning: directory does not exist.
 //       Could not make proto path relative: greet/greetpb/greet.proto: No such file or directory

what is the wrong command above ? and how to create the generated into dart directory for this?


Solution

  • I could make it work that I must create directory lib/src/generated and change the command to

    protoc --dart_out=grpc:lib/src/generated -Iblogpb blogpb/blog.proto    
    

    -Iblogpb meant what the directory of our *.proto

    if you want myprotos, you can change -Iblogpb to -Imyprotos :)