Skip to content

Commit e68c31e

Browse files
committed
Fix path text encoding creating shortcuts on windows
also fix a memory leak (hopefully) fixes: #1627
1 parent 35ecfa3 commit e68c31e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/gui/components/wxGameList.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1589,9 +1589,11 @@ void wxGameList::CreateShortcut(GameInfo2& gameInfo)
15891589
PWSTR userShortcutFolder;
15901590
SHGetKnownFolderPath(FOLDERID_Programs, 0, NULL, &userShortcutFolder);
15911591
const wxString shortcutName = wxString::Format("%s.lnk", titleName);
1592-
wxFileDialog shortcutDialog(this, _("Choose shortcut location"), _pathToUtf8(userShortcutFolder), shortcutName,
1592+
wxFileDialog shortcutDialog(this, _("Choose shortcut location"), userShortcutFolder, shortcutName,
15931593
"Shortcut (*.lnk)|*.lnk", wxFD_SAVE | wxFD_CHANGE_DIR | wxFD_OVERWRITE_PROMPT);
15941594

1595+
CoTaskMemFree(userShortcutFolder);
1596+
15951597
const auto result = shortcutDialog.ShowModal();
15961598
if (result == wxID_CANCEL)
15971599
return;
@@ -1621,7 +1623,7 @@ void wxGameList::CreateShortcut(GameInfo2& gameInfo)
16211623
}
16221624

16231625
icon_path = folder / fmt::format("{:016x}.ico", titleId);
1624-
auto stream = wxFileOutputStream(_pathToUtf8(*icon_path));
1626+
auto stream = wxFileOutputStream(icon_path->wstring());
16251627
auto image = bitmap.ConvertToImage();
16261628
wxICOHandler icohandler{};
16271629
if (!icohandler.SaveFile(&image, stream, false))

0 commit comments

Comments
 (0)