From c2c7a6786d80df28e7ddba8a63a2cd687ccfb54d Mon Sep 17 00:00:00 2001 From: "lane.wei" Date: Fri, 14 Oct 2022 18:51:59 +0800 Subject: [PATCH] FIX: fix the vendor disappear issue after de-select the printers in newbie_guide after the vendor profile is deselected the system files are deleted from userdata dir we should always load the other vendor's profiles from resource instead of userdata dir Change-Id: I29220d30d203ea318092430c02cfa662caf0f388 --- src/slic3r/GUI/WebGuideDialog.cpp | 22 +++++++++++++++++++++- src/slic3r/Utils/PresetUpdater.cpp | 6 ++++-- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/slic3r/GUI/WebGuideDialog.cpp b/src/slic3r/GUI/WebGuideDialog.cpp index 1e1f28097..03c6d80af 100644 --- a/src/slic3r/GUI/WebGuideDialog.cpp +++ b/src/slic3r/GUI/WebGuideDialog.cpp @@ -989,6 +989,7 @@ int GuideFrame::LoadProfile() //} while (_findnext(handle, &findData) == 0); // 查找目录中的下一个文件 + //load BBL bundle from user data path string targetPath = bbl_bundle_path.make_preferred().string(); boost::filesystem::path myPath(targetPath); boost::filesystem::directory_iterator endIter; @@ -1003,9 +1004,28 @@ int GuideFrame::LoadProfile() strVendor = strVendor.AfterLast( '\\'); strVendor = strVendor.AfterLast('\/'); - LoadProfileFamily(w2s(strVendor), iter->path().string()); + if (w2s(strVendor) == PresetBundle::BBL_BUNDLE) + LoadProfileFamily(w2s(strVendor), iter->path().string()); } + } + + //string others_targetPath = rsrc_vendor_dir.string(); + boost::filesystem::directory_iterator others_endIter; + for (boost::filesystem::directory_iterator iter(rsrc_vendor_dir); iter != others_endIter; iter++) { + if (boost::filesystem::is_directory(*iter)) { + //cout << "is dir" << endl; + //cout << iter->path().string() << endl; + } else { + //cout << "is a file" << endl; + //cout << iter->path().string() << endl; + wxString strVendor = from_u8(iter->path().string()).BeforeLast('.'); + strVendor = strVendor.AfterLast( '\\'); + strVendor = strVendor.AfterLast('\/'); + + if (w2s(strVendor) != PresetBundle::BBL_BUNDLE) + LoadProfileFamily(w2s(strVendor), iter->path().string()); } + } //LoadProfileFamily(PresetBundle::BBL_BUNDLE, bbl_bundle_path.string()); diff --git a/src/slic3r/Utils/PresetUpdater.cpp b/src/slic3r/Utils/PresetUpdater.cpp index 4837eb415..0d8a84d32 100644 --- a/src/slic3r/Utils/PresetUpdater.cpp +++ b/src/slic3r/Utils/PresetUpdater.cpp @@ -893,11 +893,13 @@ void PresetUpdater::priv::check_installed_vendor_profiles() const bundles.push_back(vendor_name); } } - else //if vendor has no file, copy it from resource + else if (vendor_name == PresetBundle::BBL_BUNDLE) {//if vendor has no file, copy it from resource for BBL bundles.push_back(vendor_name); + } } - else //always update configs from resource to vendor + else if (vendor_name == PresetBundle::BBL_BUNDLE) {//always update configs from resource to vendor for BBL bundles.push_back(vendor_name); + } } }