ENH: add the logic to prompt user to update network plugins

Change-Id: I73cce20e58783a365ad2665c8e095dcf2e9c02ea
This commit is contained in:
lane.wei 2022-12-22 14:40:34 +08:00 committed by Lane.Wei
parent 8b5a49f378
commit 697d945ca1
7 changed files with 289 additions and 18 deletions

View file

@ -2495,11 +2495,14 @@ bool GUI_App::on_init_inner()
void GUI_App::copy_network_if_available()
{
if (app_config->get("update_network_plugin") != "true")
return;
std::string network_library, player_library, network_library_dst, player_library_dst;
std::string data_dir_str = data_dir();
boost::filesystem::path data_dir_path(data_dir_str);
auto plugin_folder = data_dir_path / "plugins";
auto cache_folder = data_dir_path / "ota";
std::string changelog_file = cache_folder.string() + "/network_plugins.json";
#if defined(_MSC_VER) || defined(_WIN32)
network_library = cache_folder.string() + "/bambu_networking.dll";
player_library = cache_folder.string() + "/BambuSource.dll";
@ -2548,6 +2551,9 @@ void GUI_App::copy_network_if_available()
fs::remove(player_library);
BOOST_LOG_TRIVIAL(info) << __FUNCTION__<< ": Copying player library from" << player_library << " to " << player_library_dst<<" successfully.";
}
if (boost::filesystem::exists(changelog_file))
fs::remove(changelog_file);
app_config->set("update_network_plugin", "false");
}
bool GUI_App::on_init_network(bool try_backup)