diff --git a/server/masterserver/jsondatamgr.cc b/server/masterserver/jsondatamgr.cc index 55deb8d..0e11798 100644 --- a/server/masterserver/jsondatamgr.cc +++ b/server/masterserver/jsondatamgr.cc @@ -9,32 +9,28 @@ void JsonDataMgr::Init() { std::string masterserver_cluster_json_file; if (!f8::IsOnlineEnv()) { - if (App::Instance()->flags.find(2) != App::Instance()->flags.end()) { - masterserver_cluster_json_file = a8::Format("/root/pub/%d/%d/conf_test/game%d/masterserver/node%d/" - "game%d.masterserver.cluster.json", - { - GAME_ID, - App::Instance()->instance_id, - GAME_ID, - App::Instance()->node_id, - GAME_ID - }); + if (f8::IsTestEnv()) { + work_path_ = a8::Format("/root/pub/%d/%d/conf_test/game%d/masterserver.test", + { + GAME_ID, + App::Instance()->instance_id, + GAME_ID + }); } else { - masterserver_cluster_json_file = a8::Format("/var/data/conf_test/game%d/masterserver/node%d/" - "game%d.masterserver.cluster.json", - { - GAME_ID, - App::Instance()->node_id, - GAME_ID - }); + work_path_ = a8::Format("/root/pub/%d/%d/conf_test/game%d/masterserver.dev", + { + GAME_ID, + App::Instance()->instance_id, + GAME_ID + }); } - } else { - masterserver_cluster_json_file = a8::Format("../config/node%d/game%d.masterserver.cluster.json", - { - App::Instance()->node_id, - GAME_ID - }); } + masterserver_cluster_json_file = a8::Format("%s/node%d/game%d.masterserver.cluster.json", + { + work_path_, + App::Instance()->node_id, + GAME_ID + }); masterserver_cluster_json_.ReadFromFile(masterserver_cluster_json_file); } diff --git a/server/masterserver/jsondatamgr.h b/server/masterserver/jsondatamgr.h index ce10f2e..d772f01 100644 --- a/server/masterserver/jsondatamgr.h +++ b/server/masterserver/jsondatamgr.h @@ -14,6 +14,8 @@ class JsonDataMgr : public a8::Singleton std::string ip; int listen_port = 0; + private: + std::string work_path_ = "../config"; a8::XObject masterserver_cluster_json_; };