diff --git a/cpp/route_guide/helper.cc b/cpp/route_guide/helper.cc index 3e10496..d147846 100644 --- a/cpp/route_guide/helper.cc +++ b/cpp/route_guide/helper.cc @@ -55,6 +55,8 @@ std::string GetDbFileContent(int argc, char** argv) { db_path = argv_1.substr(start_position + 1); } } + } else { + db_path = "route_guide_db.json"; } std::ifstream db_file(db_path); if (!db_file.is_open()) { diff --git a/cpp/route_guide/route_guide_client.cc b/cpp/route_guide/route_guide_client.cc index acb8dd4..cbf4207 100644 --- a/cpp/route_guide/route_guide_client.cc +++ b/cpp/route_guide/route_guide_client.cc @@ -239,6 +239,7 @@ class RouteGuideClient { int main(int argc, char** argv) { grpc_init(); + // Expect only arg: --db_path=path/to/route_guide_db.json. std::string db = examples::GetDbFileContent(argc, argv); RouteGuideClient guide( grpc::CreateChannelDeprecated("localhost:50051", ChannelArguments()), diff --git a/cpp/route_guide/route_guide_server.cc b/cpp/route_guide/route_guide_server.cc index 62fee24..2699330 100644 --- a/cpp/route_guide/route_guide_server.cc +++ b/cpp/route_guide/route_guide_server.cc @@ -199,6 +199,7 @@ void RunServer(const std::string& db_path) { int main(int argc, char** argv) { grpc_init(); + // Expect only arg: --db_path=path/to/route_guide_db.json. std::string db = examples::GetDbFileContent(argc, argv); RunServer(db);