diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 572215d7d..f65e698ee 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -1092,7 +1092,7 @@ void GUI_App::post_init() if (hms_query) hms_query->check_hms_info(); }); - + std::string functional_config_file = Slic3r::resources_dir() + "/config.json"; DeviceManager::load_functional_config(encode_path(functional_config_file.c_str())); @@ -1482,6 +1482,19 @@ void GUI_App::restart_networking() BOOST_LOG_TRIVIAL(info) << __FUNCTION__<< boost::format(" exit, m_agent=%1%")%m_agent; } +void GUI_App::remove_old_networking_plugins() +{ + auto plugin_folder = boost::filesystem::path(wxStandardPaths::Get().GetUserDataDir().ToUTF8().data()) / "plugins"; + if (boost::filesystem::exists(plugin_folder)) { + BOOST_LOG_TRIVIAL(info) << "[remove_old_networking_plugins] remove the directory "<maj(); + int last_minor = m_last_config_version->min(); + int last_patch = m_last_config_version->patch()/100; + std::string studio_ver = SLIC3R_VERSION; + int cur_major = atoi(studio_ver.substr(0,2).c_str()); + int cur_minor = atoi(studio_ver.substr(3,2).c_str()); + int cur_patch = atoi(studio_ver.substr(6,2).c_str()); + BOOST_LOG_TRIVIAL(info) << boost::format("last app version {%1%.%2%.%3%}, current version {%4%.%5%.%6%}") + %last_major%last_minor%last_patch%cur_major%cur_minor%cur_patch; + if ((last_major != cur_major) + ||(last_minor != cur_minor) + ||(last_patch != cur_patch)) { + remove_old_networking_plugins(); + } } app_config->set("version", SLIC3R_VERSION); @@ -3022,16 +3045,16 @@ std::string GUI_App::handle_web_request(std::string cmd) this->request_open_project(path.value()); } } - } + } else if (command_str.compare("homepage_delete_recentfile") == 0) { if (root.get_child_optional("data") != boost::none) { pt::ptree data_node = root.get_child("data"); boost::optional path = data_node.get_optional("path"); - if (path.has_value()) { + if (path.has_value()) { this->request_remove_project(path.value()); } } - } + } else if (command_str.compare("homepage_delete_all_recentfile") == 0) { this->request_remove_project(""); } @@ -3039,8 +3062,8 @@ std::string GUI_App::handle_web_request(std::string cmd) if (root.get_child_optional("data") != boost::none) { pt::ptree data_node = root.get_child("data"); boost::optional path = data_node.get_optional("path"); - if (path.has_value()) - { + if (path.has_value()) + { boost::filesystem::path NowFile(path.value()); std::string FolderPath = NowFile.parent_path().make_preferred().string(); @@ -3081,7 +3104,7 @@ std::string GUI_App::handle_web_request(std::string cmd) e.SetEventObject(mainframe); wxPostEvent(mainframe, e); } - } + } else if (command_str.compare("userguide_wiki_open") == 0) { if (root.get_child_optional("data") != boost::none) { pt::ptree data_node = root.get_child("data"); @@ -3089,9 +3112,9 @@ std::string GUI_App::handle_web_request(std::string cmd) if (path.has_value()) { wxLaunchDefaultBrowser(path.value()); } - } + } } - + } } catch (...) { diff --git a/src/slic3r/GUI/GUI_App.hpp b/src/slic3r/GUI/GUI_App.hpp index 17329a9eb..993197722 100644 --- a/src/slic3r/GUI/GUI_App.hpp +++ b/src/slic3r/GUI/GUI_App.hpp @@ -526,6 +526,7 @@ private: bool on_init_network(bool try_backup = false); void init_networking_callbacks(); void init_app_config(); + void remove_old_networking_plugins(); //BBS set extra header for http request std::map get_extra_header(); void init_http_extra_header();