From 515de1184f53bd9a8dd76a4018dcfec890d17588 Mon Sep 17 00:00:00 2001 From: heavyrain lee Date: Sun, 2 Jun 2019 09:33:24 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?=E7=9A=84=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mars/proto/src/DB2.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/mars/proto/src/DB2.cc b/mars/proto/src/DB2.cc index 6dd3db1af..8825f221a 100644 --- a/mars/proto/src/DB2.cc +++ b/mars/proto/src/DB2.cc @@ -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();