stop checking for empty AUMIDs

The downstream code handles them just fine.
This commit is contained in:
mjk 2021-03-21 23:34:15 +00:00 committed by LAGonauta
parent 332216e63c
commit 822b91f40c
2 changed files with 2 additions and 12 deletions

View file

@ -70,17 +70,13 @@ private:
PROPVARIANT var; PROPVARIANT var;
}; };
bool ImplEnsureAumiddedShortcutExists( void ImplEnsureAumiddedShortcutExists(
const std::string_view menu_rel_path, const std::string_view narrow_aumid) const std::string_view menu_rel_path, const std::string_view narrow_aumid)
{ {
if (menu_rel_path.empty()) if (menu_rel_path.empty())
throw std::runtime_error{"empty menu-relative shortcut path"}; throw std::runtime_error{"empty menu-relative shortcut path"};
const auto aumid = sview_to_wstr(narrow_aumid); const auto aumid = sview_to_wstr(narrow_aumid);
if (aumid.empty())
{
return false;
}
const auto exe_path = GetExePath(); const auto exe_path = GetExePath();
const auto shortcut_path = GetEnv(L"APPDATA") const auto shortcut_path = GetEnv(L"APPDATA")
@ -116,8 +112,6 @@ bool ImplEnsureAumiddedShortcutExists(
constexpr auto set_file_as_current = TRUE; constexpr auto set_file_as_current = TRUE;
checked(file->Save,(shortcut_path.c_str(), set_file_as_current)); checked(file->Save,(shortcut_path.c_str(), set_file_as_current));
} }
return true;
} }
#undef checked #undef checked
@ -131,6 +125,6 @@ extern "C"
{ {
return g_try_invoke( return g_try_invoke(
ImplEnsureAumiddedShortcutExists, R"(Programs\Dino)", aumid) ImplEnsureAumiddedShortcutExists, R"(Programs\Dino)", aumid)
.value_or(false); .has_value();
} }
} }

View file

@ -76,10 +76,6 @@ std::wstring GetEnv(const wchar_t *const variable_name)
static bool ImplSetProcessAumid(const std::string_view aumid) static bool ImplSetProcessAumid(const std::string_view aumid)
{ {
const auto waumid = sview_to_wstr(aumid); const auto waumid = sview_to_wstr(aumid);
if (waumid.empty())
{
return false;
}
return SUCCEEDED(::SetCurrentProcessExplicitAppUserModelID(waumid.c_str())); return SUCCEEDED(::SetCurrentProcessExplicitAppUserModelID(waumid.c_str()));
} }