0

I've tried to generate objc protofiles for each subfolder from root:

protoc */*.proto --objc_out="../result"  -I.

enter image description here

Example proto:

syntax = "proto2";

message MyProtoType {
    required string myProtoName = 1;
}

And protoc successfully generates objc files, but .m file contains not correct #import

// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: MyFolder/MyProto.proto

...

#import "MyFolder/MyProto.pbobjc.h"
// @@protoc_insertion_point(imports)

...

Somebody can explain how to generate correct import, without running protoc in each subfolder protoc *.proto --objc_out="../result" -I. with a script that loops through them?

Andriy Savran
  • 535
  • 3
  • 19

1 Answers1

0

There is nothing wrong with the generated code. If you want to generate #import statements without any path and do not mind if the output files are at the root directory instead of the location of the .proto file, add the folder to the protoc search directories with --proto_path.

protoc */*.proto --objc_out=. --proto_path MyFolder
Jan-Gerd
  • 1,261
  • 8
  • 8