| 487 | } |
| 488 | |
| 489 | Status ApiDefMap::LoadFile(Env* env, const string& filename) { |
| 490 | if (filename.empty()) return Status::OK(); |
| 491 | string contents; |
| 492 | TF_RETURN_IF_ERROR(ReadFileToString(env, filename, &contents)); |
| 493 | Status status = LoadApiDef(contents); |
| 494 | if (!status.ok()) { |
| 495 | // Return failed status annotated with filename to aid in debugging. |
| 496 | return Status(status.code(), |
| 497 | strings::StrCat("Error parsing ApiDef file ", filename, ": ", |
| 498 | status.error_message())); |
| 499 | } |
| 500 | return Status::OK(); |
| 501 | } |
| 502 | |
| 503 | Status ApiDefMap::LoadApiDef(const string& api_def_file_contents) { |
| 504 | const string contents = PBTxtFromMultiline(api_def_file_contents); |