Add default json path
This commit is contained in:
parent
57d306e78e
commit
9f392590bb
|
|
@ -55,6 +55,8 @@ std::string GetDbFileContent(int argc, char** argv) {
|
||||||
db_path = argv_1.substr(start_position + 1);
|
db_path = argv_1.substr(start_position + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
db_path = "route_guide_db.json";
|
||||||
}
|
}
|
||||||
std::ifstream db_file(db_path);
|
std::ifstream db_file(db_path);
|
||||||
if (!db_file.is_open()) {
|
if (!db_file.is_open()) {
|
||||||
|
|
|
||||||
|
|
@ -239,6 +239,7 @@ class RouteGuideClient {
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
grpc_init();
|
grpc_init();
|
||||||
|
|
||||||
|
// Expect only arg: --db_path=path/to/route_guide_db.json.
|
||||||
std::string db = examples::GetDbFileContent(argc, argv);
|
std::string db = examples::GetDbFileContent(argc, argv);
|
||||||
RouteGuideClient guide(
|
RouteGuideClient guide(
|
||||||
grpc::CreateChannelDeprecated("localhost:50051", ChannelArguments()),
|
grpc::CreateChannelDeprecated("localhost:50051", ChannelArguments()),
|
||||||
|
|
|
||||||
|
|
@ -199,6 +199,7 @@ void RunServer(const std::string& db_path) {
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
grpc_init();
|
grpc_init();
|
||||||
|
|
||||||
|
// Expect only arg: --db_path=path/to/route_guide_db.json.
|
||||||
std::string db = examples::GetDbFileContent(argc, argv);
|
std::string db = examples::GetDbFileContent(argc, argv);
|
||||||
RunServer(db);
|
RunServer(db);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue