add the backup logic to make sure plugin install success

Change-Id: Id9da725ffe2e6d604c2771abf89cf445824793db
This commit is contained in:
lane.wei 2022-08-07 23:43:28 +08:00 committed by Yifan Wu
parent a9e3bb59a0
commit 49fc813383
4 changed files with 37 additions and 5 deletions

View file

@ -107,12 +107,16 @@ NetworkAgent::~NetworkAgent()
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", this %1%, network_agent=%2%, destroy_agent_ptr=%3%, ret %4%")%this %network_agent %destroy_agent_ptr %ret;
}
int NetworkAgent::initialize_network_module()
int NetworkAgent::initialize_network_module(bool using_backup)
{
//int ret = -1;
std::string library;
auto plugin_folder = boost::filesystem::path(wxStandardPaths::Get().GetUserDataDir().ToUTF8().data()) / "plugins";
if (using_backup) {
plugin_folder = plugin_folder/"backup";
}
//first load the library
#if defined(_MSC_VER) || defined(_WIN32)
library = plugin_folder.string() + "/" + std::string(BAMBU_NETWORK_LIBRARY) + ".dll";