Skip to content

Commit e5d7d5d

Browse files
authored
Use utf8 aware string conversion for wxLaunchDefaultBrowser() (#185)
1 parent 0030fa4 commit e5d7d5d

File tree

5 files changed

+11
-9
lines changed

5 files changed

+11
-9
lines changed

src/gui/ChecksumTool.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "gui/helpers/wxCustomEvents.h"
55
#include "util/helpers/helpers.h"
66
#include "gui/helpers/wxHelpers.h"
7+
#include "gui/wxHelper.h"
78
#include "Cafe/Filesystem/WUD/wud.h"
89

910
#include <zip.h>
@@ -518,7 +519,7 @@ void ChecksumTool::VerifyJsonEntry(const rapidjson::Document& doc)
518519
file.flush();
519520
file.close();
520521

521-
wxLaunchDefaultBrowser(fmt::format("file:{}", path));
522+
wxLaunchDefaultBrowser(wxHelper::FromUtf8(fmt::format("file:{}", path)));
522523
}
523524
else
524525
wxMessageBox(_("Can't open file to write!"), _("Error"), wxOK | wxCENTRE | wxICON_ERROR, this);

src/gui/MainWindow.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1945,7 +1945,7 @@ class CemuAboutDialog : public wxDialog
19451945
"/*****************************************************************************/\r\n"
19461946
);
19471947
delete fs;
1948-
wxLaunchDefaultBrowser(fmt::format("file:{}", _utf8Wrapper(tempPath)));
1948+
wxLaunchDefaultBrowser(wxHelper::FromUtf8(fmt::format("file:{}", _utf8Wrapper(tempPath))));
19491949
});
19501950
lineSizer->Add(noticeLink, 0);
19511951
lineSizer->Add(new wxStaticText(parent, -1, ")"), 0);

src/gui/TitleManager.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "Cafe/TitleList/GameInfo.h"
66
#include "util/helpers/helpers.h"
77
#include "gui/helpers/wxHelpers.h"
8+
#include "gui/wxHelper.h"
89
#include "gui/components/wxTitleManagerList.h"
910
#include "gui/components/wxDownloadManagerList.h"
1011
#include "gui/GameUpdateWindow.h"
@@ -479,7 +480,7 @@ void TitleManager::OnSaveOpenDirectory(wxCommandEvent& event)
479480
if (!fs::exists(target) || !fs::is_directory(target))
480481
return;
481482

482-
wxLaunchDefaultBrowser(fmt::format("file:{}", _utf8Wrapper(target)));
483+
wxLaunchDefaultBrowser(wxHelper::FromUtf8(fmt::format("file:{}", _utf8Wrapper(target))));
483484
}
484485

485486
void TitleManager::OnSaveDelete(wxCommandEvent& event)

src/gui/components/wxGameList.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ void wxGameList::OnContextMenuSelected(wxCommandEvent& event)
563563
{
564564
fs::path path(gameInfo.GetBase().GetPath());
565565
_stripPathFilename(path);
566-
wxLaunchDefaultBrowser(fmt::format("file:{}", _utf8Wrapper(path)));
566+
wxLaunchDefaultBrowser(wxHelper::FromUtf8(fmt::format("file:{}", _utf8Wrapper(path))));
567567
break;
568568
}
569569
case kWikiPage:
@@ -577,28 +577,28 @@ void wxGameList::OnContextMenuSelected(wxCommandEvent& event)
577577
wxASSERT(!tokens.empty());
578578
const std::string company_code = gameInfo.GetBase().GetMetaInfo()->GetCompanyCode();
579579
wxASSERT(company_code.size() >= 2);
580-
wxLaunchDefaultBrowser(fmt::format("https://wiki.cemu.info/wiki/{}{}", *tokens.rbegin(), company_code.substr(company_code.size() - 2).c_str()));
580+
wxLaunchDefaultBrowser(wxHelper::FromUtf8(fmt::format("https://wiki.cemu.info/wiki/{}{}", *tokens.rbegin(), company_code.substr(company_code.size() - 2).c_str())));
581581
}
582582
break;
583583
}
584584

585585
case kContextMenuSaveFolder:
586586
{
587-
wxLaunchDefaultBrowser(fmt::format("file:{}", _utf8Wrapper(gameInfo.GetSaveFolder())));
587+
wxLaunchDefaultBrowser(wxHelper::FromUtf8(fmt::format("file:{}", _utf8Wrapper(gameInfo.GetSaveFolder()))));
588588
break;
589589
}
590590
case kContextMenuUpdateFolder:
591591
{
592592
fs::path path(gameInfo.GetUpdate().GetPath());
593593
_stripPathFilename(path);
594-
wxLaunchDefaultBrowser(fmt::format("file:{}", _utf8Wrapper(path)));
594+
wxLaunchDefaultBrowser(wxHelper::FromUtf8(fmt::format("file:{}", _utf8Wrapper(path))));
595595
break;
596596
}
597597
case kContextMenuDLCFolder:
598598
{
599599
fs::path path(gameInfo.GetAOC().front().GetPath());
600600
_stripPathFilename(path);
601-
wxLaunchDefaultBrowser(fmt::format("file:{}", _utf8Wrapper(path)));
601+
wxLaunchDefaultBrowser(wxHelper::FromUtf8(fmt::format("file:{}", _utf8Wrapper(path))));
602602
break;
603603
}
604604
case kContextMenuEditGraphicPacks:

src/gui/components/wxTitleManagerList.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -852,7 +852,7 @@ void wxTitleManagerList::OnContextMenuSelected(wxCommandEvent& event)
852852
case kContextMenuOpenDirectory:
853853
{
854854
const auto path = fs::is_directory(entry->path) ? entry->path : entry->path.parent_path();
855-
wxLaunchDefaultBrowser(fmt::format("file:{}", _utf8Wrapper(path)));
855+
wxLaunchDefaultBrowser(wxHelper::FromUtf8(fmt::format("file:{}", _utf8Wrapper(path))));
856856
}
857857
break;
858858
case kContextMenuDelete:

0 commit comments

Comments
 (0)