constify all the things

This commit is contained in:
mjk 2021-03-06 00:30:06 +00:00 committed by LAGonauta
parent 401c4a1bb1
commit f193948f4e
2 changed files with 6 additions and 8 deletions

View file

@ -128,19 +128,17 @@ int32_t ValidateShortcut(const std::wstring& shortcut_path, const std::wstring&
static bool ImplEnsureAumiddedShortcutExists( static bool ImplEnsureAumiddedShortcutExists(
const std::string_view menu_rel_path, const std::string_view aumid) const std::string_view menu_rel_path, const std::string_view aumid)
{ {
auto waumid = sview_to_wstr(aumid); const auto waumid = sview_to_wstr(aumid);
if (waumid.empty()) if (waumid.empty())
{ {
return false; return false;
} }
auto exePath = GetExePath(); const auto path = GetEnv(L"APPDATA") + LR"(\Microsoft\Windows\Start Menu\)"
auto path = GetEnv(L"APPDATA") + LR"(\Microsoft\Windows\Start Menu\)"
+ sview_to_wstr(menu_rel_path) + L".lnk"; + sview_to_wstr(menu_rel_path) + L".lnk";
if (!std::filesystem::exists(path)) if (!std::filesystem::exists(path))
{ {
return SUCCEEDED(InstallShortcut(exePath, waumid, path)); return SUCCEEDED(InstallShortcut(GetExePath(), waumid, path));
} }
else else
{ {
@ -150,7 +148,7 @@ static bool ImplEnsureAumiddedShortcutExists(
extern "C" extern "C"
{ {
gboolean EnsureAumiddedShortcutExists(const gchar* aumid) noexcept gboolean EnsureAumiddedShortcutExists(const gchar *const aumid) noexcept
{ {
return g_try_invoke( return g_try_invoke(
ImplEnsureAumiddedShortcutExists, R"(Programs\Dino)", aumid); ImplEnsureAumiddedShortcutExists, R"(Programs\Dino)", aumid);

View file

@ -41,7 +41,7 @@ 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)
{ {
auto waumid = sview_to_wstr(aumid); const auto waumid = sview_to_wstr(aumid);
if (waumid.empty()) if (waumid.empty())
{ {
return false; return false;
@ -65,7 +65,7 @@ extern "C"
return FALSE; return FALSE;
} }
gboolean SetProcessAumid(const gchar* aumid) noexcept gboolean SetProcessAumid(const gchar *const aumid) noexcept
{ {
return g_try_invoke(ImplSetProcessAumid, aumid); return g_try_invoke(ImplSetProcessAumid, aumid);
} }