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
This commit is contained in:
lane.wei 2022-10-14 18:51:59 +08:00 committed by Lane.Wei
parent 0aef20dd23
commit c2c7a6786d
2 changed files with 25 additions and 3 deletions

View File

@ -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());

View File

@ -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);
}
}
}