From e68c31e5fbc089fddb25b60d51969f12ba909ce0 Mon Sep 17 00:00:00 2001 From: goeiecool9999 <7033575+goeiecool9999@users.noreply.github.com> Date: Wed, 2 Jul 2025 12:41:04 +0200 Subject: [PATCH] Fix path text encoding creating shortcuts on windows also fix a memory leak (hopefully) fixes: #1627 --- src/gui/components/wxGameList.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui/components/wxGameList.cpp b/src/gui/components/wxGameList.cpp index 587374f6..e30b16f5 100644 --- a/src/gui/components/wxGameList.cpp +++ b/src/gui/components/wxGameList.cpp @@ -1589,9 +1589,11 @@ void wxGameList::CreateShortcut(GameInfo2& gameInfo) PWSTR userShortcutFolder; SHGetKnownFolderPath(FOLDERID_Programs, 0, NULL, &userShortcutFolder); const wxString shortcutName = wxString::Format("%s.lnk", titleName); - wxFileDialog shortcutDialog(this, _("Choose shortcut location"), _pathToUtf8(userShortcutFolder), shortcutName, + wxFileDialog shortcutDialog(this, _("Choose shortcut location"), userShortcutFolder, shortcutName, "Shortcut (*.lnk)|*.lnk", wxFD_SAVE | wxFD_CHANGE_DIR | wxFD_OVERWRITE_PROMPT); + CoTaskMemFree(userShortcutFolder); + const auto result = shortcutDialog.ShowModal(); if (result == wxID_CANCEL) return; @@ -1621,7 +1623,7 @@ void wxGameList::CreateShortcut(GameInfo2& gameInfo) } icon_path = folder / fmt::format("{:016x}.ico", titleId); - auto stream = wxFileOutputStream(_pathToUtf8(*icon_path)); + auto stream = wxFileOutputStream(icon_path->wstring()); auto image = bitmap.ConvertToImage(); wxICOHandler icohandler{}; if (!icohandler.SaveFile(&image, stream, false))