Add default json path

This commit is contained in:
Yang Gao 2015-02-23 22:51:14 -08:00
parent 57d306e78e
commit 9f392590bb
3 changed files with 4 additions and 0 deletions

View File

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

View File

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

View File

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