mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-07-04 05:51:19 +12:00
Fix path text encoding creating shortcuts on windows
also fix a memory leak (hopefully) fixes: #1627
This commit is contained in:
parent
35ecfa3f54
commit
e68c31e5fb
1 changed files with 4 additions and 2 deletions
|
@ -1589,9 +1589,11 @@ void wxGameList::CreateShortcut(GameInfo2& gameInfo)
|
||||||
PWSTR userShortcutFolder;
|
PWSTR userShortcutFolder;
|
||||||
SHGetKnownFolderPath(FOLDERID_Programs, 0, NULL, &userShortcutFolder);
|
SHGetKnownFolderPath(FOLDERID_Programs, 0, NULL, &userShortcutFolder);
|
||||||
const wxString shortcutName = wxString::Format("%s.lnk", titleName);
|
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);
|
"Shortcut (*.lnk)|*.lnk", wxFD_SAVE | wxFD_CHANGE_DIR | wxFD_OVERWRITE_PROMPT);
|
||||||
|
|
||||||
|
CoTaskMemFree(userShortcutFolder);
|
||||||
|
|
||||||
const auto result = shortcutDialog.ShowModal();
|
const auto result = shortcutDialog.ShowModal();
|
||||||
if (result == wxID_CANCEL)
|
if (result == wxID_CANCEL)
|
||||||
return;
|
return;
|
||||||
|
@ -1621,7 +1623,7 @@ void wxGameList::CreateShortcut(GameInfo2& gameInfo)
|
||||||
}
|
}
|
||||||
|
|
||||||
icon_path = folder / fmt::format("{:016x}.ico", titleId);
|
icon_path = folder / fmt::format("{:016x}.ico", titleId);
|
||||||
auto stream = wxFileOutputStream(_pathToUtf8(*icon_path));
|
auto stream = wxFileOutputStream(icon_path->wstring());
|
||||||
auto image = bitmap.ConvertToImage();
|
auto image = bitmap.ConvertToImage();
|
||||||
wxICOHandler icohandler{};
|
wxICOHandler icohandler{};
|
||||||
if (!icohandler.SaveFile(&image, stream, false))
|
if (!icohandler.SaveFile(&image, stream, false))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue