From f6ff0f6131e18b2407b08ff2d0b665cb146e632b Mon Sep 17 00:00:00 2001 From: "chunmao.guo" Date: Tue, 22 Nov 2022 11:15:01 +0800 Subject: [PATCH] FIX: re-register BambuSource when maybe installed under administrator Change-Id: Iff4c4dc9a581de33e08681b7033c1f29ebacb6a4 --- src/slic3r/GUI/wxMediaCtrl2.cpp | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/slic3r/GUI/wxMediaCtrl2.cpp b/src/slic3r/GUI/wxMediaCtrl2.cpp index fd683f9d7..0f8931fad 100644 --- a/src/slic3r/GUI/wxMediaCtrl2.cpp +++ b/src/slic3r/GUI/wxMediaCtrl2.cpp @@ -58,20 +58,18 @@ void wxMediaCtrl2::Load(wxURI url) BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": clsid %1% path %2%") % clsid % path; if (path.empty() || !wxFile::Exists(path) || clsid != CLSID_BAMBU_SOURCE) { - if (clsid != CLSID_BAMBU_SOURCE || path.empty()) { - std::string data_dir_str = Slic3r::data_dir(); - boost::filesystem::path data_dir_path(data_dir_str); - auto dll_path = data_dir_path / "plugins" / "BambuSource.dll"; - if (boost::filesystem::exists(dll_path)) { - Slic3r::GUI::wxGetApp().CallAfter( - [dll_path] { - int res = wxMessageBox(_L("BambuSource has not correctly been registered for media playing! Press Yes to re-register it."), _L("Error"), wxYES_NO); - if (res == wxYES) { - SHELLEXECUTEINFO info{sizeof(info), 0, NULL, L"runas", L"regsvr32", dll_path.wstring().c_str(), SW_HIDE }; - ::ShellExecuteEx(&info); - } - }); - } + std::string data_dir_str = Slic3r::data_dir(); + boost::filesystem::path data_dir_path(data_dir_str); + auto dll_path = data_dir_path / "plugins" / "BambuSource.dll"; + if (boost::filesystem::exists(dll_path)) { + Slic3r::GUI::wxGetApp().CallAfter( + [dll_path] { + int res = wxMessageBox(_L("BambuSource has not correctly been registered for media playing! Press Yes to re-register it."), _L("Error"), wxYES_NO); + if (res == wxYES) { + SHELLEXECUTEINFO info{sizeof(info), 0, NULL, L"runas", L"regsvr32", dll_path.wstring().c_str(), SW_HIDE }; + ::ShellExecuteEx(&info); + } + }); } else { Slic3r::GUI::wxGetApp().CallAfter([] { wxMessageBox(_L("Missing BambuSource component registered for media playing! Please re-install BambuStutio or seek after-sales help."), _L("Error"), wxOK);