mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-14 04:27:36 +00:00
feat: suppress runtime file associations in MSIX Store build
This commit is contained in:
@@ -9114,6 +9114,10 @@ static bool del_win_registry(HKEY hkeyHive, const wchar_t *pszVar, const wchar_t
|
|||||||
void GUI_App::associate_files(std::wstring extend)
|
void GUI_App::associate_files(std::wstring extend)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
// MSIX: shell integration is declared in the package manifest; registry
|
||||||
|
// writes from a packaged process are virtualized and invisible to the shell.
|
||||||
|
if (is_running_in_msix())
|
||||||
|
return;
|
||||||
wchar_t app_path[MAX_PATH];
|
wchar_t app_path[MAX_PATH];
|
||||||
::GetModuleFileNameW(nullptr, app_path, sizeof(app_path));
|
::GetModuleFileNameW(nullptr, app_path, sizeof(app_path));
|
||||||
|
|
||||||
@@ -9139,6 +9143,8 @@ void GUI_App::associate_files(std::wstring extend)
|
|||||||
void GUI_App::disassociate_files(std::wstring extend)
|
void GUI_App::disassociate_files(std::wstring extend)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
if (is_running_in_msix())
|
||||||
|
return;
|
||||||
wchar_t app_path[MAX_PATH];
|
wchar_t app_path[MAX_PATH];
|
||||||
::GetModuleFileNameW(nullptr, app_path, sizeof(app_path));
|
::GetModuleFileNameW(nullptr, app_path, sizeof(app_path));
|
||||||
|
|
||||||
@@ -9190,6 +9196,8 @@ bool GUI_App::check_url_association(std::wstring url_prefix, std::wstring& reg_b
|
|||||||
void GUI_App::associate_url(std::wstring url_prefix)
|
void GUI_App::associate_url(std::wstring url_prefix)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
if (is_running_in_msix())
|
||||||
|
return;
|
||||||
boost::filesystem::path binary_path(boost::filesystem::canonical(boost::dll::program_location()));
|
boost::filesystem::path binary_path(boost::filesystem::canonical(boost::dll::program_location()));
|
||||||
wxString wbinary = from_path(binary_path);
|
wxString wbinary = from_path(binary_path);
|
||||||
BOOST_LOG_TRIVIAL(info) << "Downloader registration: Path of binary: " << wbinary.ToUTF8().data();
|
BOOST_LOG_TRIVIAL(info) << "Downloader registration: Path of binary: " << wbinary.ToUTF8().data();
|
||||||
@@ -9215,6 +9223,8 @@ void GUI_App::associate_url(std::wstring url_prefix)
|
|||||||
void GUI_App::disassociate_url(std::wstring url_prefix)
|
void GUI_App::disassociate_url(std::wstring url_prefix)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
if (is_running_in_msix())
|
||||||
|
return;
|
||||||
wxRegKey key_full(wxRegKey::HKCU, "Software\\Classes\\" + url_prefix + "\\shell\\open\\command");
|
wxRegKey key_full(wxRegKey::HKCU, "Software\\Classes\\" + url_prefix + "\\shell\\open\\command");
|
||||||
if (!key_full.Exists()) {
|
if (!key_full.Exists()) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1846,6 +1846,9 @@ void PreferencesDialog::create_items()
|
|||||||
//// ASSOCIATE TAB
|
//// ASSOCIATE TAB
|
||||||
/////////////////////////////////////
|
/////////////////////////////////////
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
// MSIX: associations are declared in the package manifest and defaults are
|
||||||
|
// managed by Windows Settings; the runtime registry toggles below cannot work.
|
||||||
|
if (!is_running_in_msix()) {
|
||||||
m_pref_tabs->AppendItem(_L("Associate"));
|
m_pref_tabs->AppendItem(_L("Associate"));
|
||||||
f_sizers.push_back(new wxFlexGridSizer(1, 1, v_gap, 0));
|
f_sizers.push_back(new wxFlexGridSizer(1, 1, v_gap, 0));
|
||||||
g_sizer = f_sizers.back();
|
g_sizer = f_sizers.back();
|
||||||
@@ -1880,6 +1883,7 @@ void PreferencesDialog::create_items()
|
|||||||
|
|
||||||
g_sizer->AddSpacer(FromDIP(10));
|
g_sizer->AddSpacer(FromDIP(10));
|
||||||
sizer_page->Add(g_sizer, 0, wxEXPAND);
|
sizer_page->Add(g_sizer, 0, wxEXPAND);
|
||||||
|
}
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
|
|
||||||
//////////////////////////
|
//////////////////////////
|
||||||
|
|||||||
Reference in New Issue
Block a user