mirror of
https://github.com/cemu-project/Cemu.git
synced 2024-11-26 02:54:17 +01:00
Windows: Save icons to Cemu user data directory (#1390)
This commit is contained in:
parent
f9a4b2dbb1
commit
63e1289bb5
@ -1392,7 +1392,6 @@ void wxGameList::CreateShortcut(GameInfo2& gameInfo)
|
|||||||
const auto outputPath = shortcutDialog.GetPath();
|
const auto outputPath = shortcutDialog.GetPath();
|
||||||
|
|
||||||
std::optional<fs::path> icon_path = std::nullopt;
|
std::optional<fs::path> icon_path = std::nullopt;
|
||||||
[&]()
|
|
||||||
{
|
{
|
||||||
int iconIdx;
|
int iconIdx;
|
||||||
int smallIconIdx;
|
int smallIconIdx;
|
||||||
@ -1402,15 +1401,13 @@ void wxGameList::CreateShortcut(GameInfo2& gameInfo)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto icon = m_image_list->GetIcon(iconIdx);
|
const auto icon = m_image_list->GetIcon(iconIdx);
|
||||||
PWSTR localAppData;
|
const auto folder = ActiveSettings::GetUserDataPath("icons");
|
||||||
const auto hres = SHGetKnownFolderPath(FOLDERID_LocalAppData, 0, NULL, &localAppData);
|
if (!fs::exists(folder) && !fs::create_directories(folder))
|
||||||
wxBitmap bitmap{};
|
|
||||||
auto folder = fs::path(localAppData) / "Cemu" / "icons";
|
|
||||||
if (!SUCCEEDED(hres) || (!fs::exists(folder) && !fs::create_directories(folder)))
|
|
||||||
{
|
{
|
||||||
cemuLog_log(LogType::Force, "Failed to create icon directory");
|
cemuLog_log(LogType::Force, "Failed to create icon directory");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
wxBitmap bitmap{};
|
||||||
if (!bitmap.CopyFromIcon(icon))
|
if (!bitmap.CopyFromIcon(icon))
|
||||||
{
|
{
|
||||||
cemuLog_log(LogType::Force, "Failed to copy icon");
|
cemuLog_log(LogType::Force, "Failed to copy icon");
|
||||||
@ -1426,7 +1423,7 @@ void wxGameList::CreateShortcut(GameInfo2& gameInfo)
|
|||||||
icon_path = std::nullopt;
|
icon_path = std::nullopt;
|
||||||
cemuLog_log(LogType::Force, "Icon failed to save");
|
cemuLog_log(LogType::Force, "Icon failed to save");
|
||||||
}
|
}
|
||||||
}();
|
}
|
||||||
|
|
||||||
IShellLinkW* shellLink;
|
IShellLinkW* shellLink;
|
||||||
HRESULT hres = CoCreateInstance(CLSID_ShellLink, nullptr, CLSCTX_INPROC_SERVER, IID_IShellLink, reinterpret_cast<LPVOID*>(&shellLink));
|
HRESULT hres = CoCreateInstance(CLSID_ShellLink, nullptr, CLSCTX_INPROC_SERVER, IID_IShellLink, reinterpret_cast<LPVOID*>(&shellLink));
|
||||||
|
Loading…
Reference in New Issue
Block a user