Skip to content

Commit

Permalink
移动数据库的位置
Browse files Browse the repository at this point in the history
  • Loading branch information
heavyrain2012 committed Jun 2, 2019
1 parent b2f054e commit 515de11
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions mars/proto/src/DB2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -261,14 +261,17 @@ namespace mars {
void DB2::Open(const std::string &sec) {
secret = sec;

std::string path = app::GetAppFilePath();
std::string path = app::GetAppFilePath() + "/" + app::GetDeviceInfo().clientid;
std::string DB2Path = path + "/" + DB2_NAME;
if(!boost::filesystem::exists(path)) {
boost::filesystem::create_directories(path);
std::string oldDB = app::GetAppFilePath() + "/" + DB2_NAME;
if (boost::filesystem::exists(oldDB)) {
boost::filesystem::copy(oldDB, DB2Path);
boost::filesystem::remove(oldDB);
}
}


std::string DB2Path = path + "/" + DB2_NAME;

xerror2("open db %s",DB2Path.c_str());

closeDB();
Expand Down

0 comments on commit 515de11

Please sign in to comment.