Add default json path

pull/3109/head
Yang Gao 10 years ago
parent 57d306e78e
commit 9f392590bb
  1. 2
      cpp/route_guide/helper.cc
  2. 1
      cpp/route_guide/route_guide_client.cc
  3. 1
      cpp/route_guide/route_guide_server.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()) {

@ -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()),

@ -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);

Loading…
Cancel
Save