mirror of
https://github.com/cemu-project/Cemu.git
synced 2024-12-25 17:21:52 +01:00
Use utf8 aware string conversion for wxLaunchDefaultBrowser() (#185)
This commit is contained in:
parent
0030fa44a5
commit
e5d7d5d173
@ -4,6 +4,7 @@
|
|||||||
#include "gui/helpers/wxCustomEvents.h"
|
#include "gui/helpers/wxCustomEvents.h"
|
||||||
#include "util/helpers/helpers.h"
|
#include "util/helpers/helpers.h"
|
||||||
#include "gui/helpers/wxHelpers.h"
|
#include "gui/helpers/wxHelpers.h"
|
||||||
|
#include "gui/wxHelper.h"
|
||||||
#include "Cafe/Filesystem/WUD/wud.h"
|
#include "Cafe/Filesystem/WUD/wud.h"
|
||||||
|
|
||||||
#include <zip.h>
|
#include <zip.h>
|
||||||
@ -518,7 +519,7 @@ void ChecksumTool::VerifyJsonEntry(const rapidjson::Document& doc)
|
|||||||
file.flush();
|
file.flush();
|
||||||
file.close();
|
file.close();
|
||||||
|
|
||||||
wxLaunchDefaultBrowser(fmt::format("file:{}", path));
|
wxLaunchDefaultBrowser(wxHelper::FromUtf8(fmt::format("file:{}", path)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
wxMessageBox(_("Can't open file to write!"), _("Error"), wxOK | wxCENTRE | wxICON_ERROR, this);
|
wxMessageBox(_("Can't open file to write!"), _("Error"), wxOK | wxCENTRE | wxICON_ERROR, this);
|
||||||
|
@ -1945,7 +1945,7 @@ public:
|
|||||||
"/*****************************************************************************/\r\n"
|
"/*****************************************************************************/\r\n"
|
||||||
);
|
);
|
||||||
delete fs;
|
delete fs;
|
||||||
wxLaunchDefaultBrowser(fmt::format("file:{}", _utf8Wrapper(tempPath)));
|
wxLaunchDefaultBrowser(wxHelper::FromUtf8(fmt::format("file:{}", _utf8Wrapper(tempPath))));
|
||||||
});
|
});
|
||||||
lineSizer->Add(noticeLink, 0);
|
lineSizer->Add(noticeLink, 0);
|
||||||
lineSizer->Add(new wxStaticText(parent, -1, ")"), 0);
|
lineSizer->Add(new wxStaticText(parent, -1, ")"), 0);
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include "Cafe/TitleList/GameInfo.h"
|
#include "Cafe/TitleList/GameInfo.h"
|
||||||
#include "util/helpers/helpers.h"
|
#include "util/helpers/helpers.h"
|
||||||
#include "gui/helpers/wxHelpers.h"
|
#include "gui/helpers/wxHelpers.h"
|
||||||
|
#include "gui/wxHelper.h"
|
||||||
#include "gui/components/wxTitleManagerList.h"
|
#include "gui/components/wxTitleManagerList.h"
|
||||||
#include "gui/components/wxDownloadManagerList.h"
|
#include "gui/components/wxDownloadManagerList.h"
|
||||||
#include "gui/GameUpdateWindow.h"
|
#include "gui/GameUpdateWindow.h"
|
||||||
@ -479,7 +480,7 @@ void TitleManager::OnSaveOpenDirectory(wxCommandEvent& event)
|
|||||||
if (!fs::exists(target) || !fs::is_directory(target))
|
if (!fs::exists(target) || !fs::is_directory(target))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxLaunchDefaultBrowser(fmt::format("file:{}", _utf8Wrapper(target)));
|
wxLaunchDefaultBrowser(wxHelper::FromUtf8(fmt::format("file:{}", _utf8Wrapper(target))));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TitleManager::OnSaveDelete(wxCommandEvent& event)
|
void TitleManager::OnSaveDelete(wxCommandEvent& event)
|
||||||
|
@ -563,7 +563,7 @@ void wxGameList::OnContextMenuSelected(wxCommandEvent& event)
|
|||||||
{
|
{
|
||||||
fs::path path(gameInfo.GetBase().GetPath());
|
fs::path path(gameInfo.GetBase().GetPath());
|
||||||
_stripPathFilename(path);
|
_stripPathFilename(path);
|
||||||
wxLaunchDefaultBrowser(fmt::format("file:{}", _utf8Wrapper(path)));
|
wxLaunchDefaultBrowser(wxHelper::FromUtf8(fmt::format("file:{}", _utf8Wrapper(path))));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case kWikiPage:
|
case kWikiPage:
|
||||||
@ -577,28 +577,28 @@ void wxGameList::OnContextMenuSelected(wxCommandEvent& event)
|
|||||||
wxASSERT(!tokens.empty());
|
wxASSERT(!tokens.empty());
|
||||||
const std::string company_code = gameInfo.GetBase().GetMetaInfo()->GetCompanyCode();
|
const std::string company_code = gameInfo.GetBase().GetMetaInfo()->GetCompanyCode();
|
||||||
wxASSERT(company_code.size() >= 2);
|
wxASSERT(company_code.size() >= 2);
|
||||||
wxLaunchDefaultBrowser(fmt::format("https://wiki.cemu.info/wiki/{}{}", *tokens.rbegin(), company_code.substr(company_code.size() - 2).c_str()));
|
wxLaunchDefaultBrowser(wxHelper::FromUtf8(fmt::format("https://wiki.cemu.info/wiki/{}{}", *tokens.rbegin(), company_code.substr(company_code.size() - 2).c_str())));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case kContextMenuSaveFolder:
|
case kContextMenuSaveFolder:
|
||||||
{
|
{
|
||||||
wxLaunchDefaultBrowser(fmt::format("file:{}", _utf8Wrapper(gameInfo.GetSaveFolder())));
|
wxLaunchDefaultBrowser(wxHelper::FromUtf8(fmt::format("file:{}", _utf8Wrapper(gameInfo.GetSaveFolder()))));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case kContextMenuUpdateFolder:
|
case kContextMenuUpdateFolder:
|
||||||
{
|
{
|
||||||
fs::path path(gameInfo.GetUpdate().GetPath());
|
fs::path path(gameInfo.GetUpdate().GetPath());
|
||||||
_stripPathFilename(path);
|
_stripPathFilename(path);
|
||||||
wxLaunchDefaultBrowser(fmt::format("file:{}", _utf8Wrapper(path)));
|
wxLaunchDefaultBrowser(wxHelper::FromUtf8(fmt::format("file:{}", _utf8Wrapper(path))));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case kContextMenuDLCFolder:
|
case kContextMenuDLCFolder:
|
||||||
{
|
{
|
||||||
fs::path path(gameInfo.GetAOC().front().GetPath());
|
fs::path path(gameInfo.GetAOC().front().GetPath());
|
||||||
_stripPathFilename(path);
|
_stripPathFilename(path);
|
||||||
wxLaunchDefaultBrowser(fmt::format("file:{}", _utf8Wrapper(path)));
|
wxLaunchDefaultBrowser(wxHelper::FromUtf8(fmt::format("file:{}", _utf8Wrapper(path))));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case kContextMenuEditGraphicPacks:
|
case kContextMenuEditGraphicPacks:
|
||||||
|
@ -852,7 +852,7 @@ void wxTitleManagerList::OnContextMenuSelected(wxCommandEvent& event)
|
|||||||
case kContextMenuOpenDirectory:
|
case kContextMenuOpenDirectory:
|
||||||
{
|
{
|
||||||
const auto path = fs::is_directory(entry->path) ? entry->path : entry->path.parent_path();
|
const auto path = fs::is_directory(entry->path) ? entry->path : entry->path.parent_path();
|
||||||
wxLaunchDefaultBrowser(fmt::format("file:{}", _utf8Wrapper(path)));
|
wxLaunchDefaultBrowser(wxHelper::FromUtf8(fmt::format("file:{}", _utf8Wrapper(path))));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case kContextMenuDelete:
|
case kContextMenuDelete:
|
||||||
|
Loading…
Reference in New Issue
Block a user