diff --git a/src/Cafe/CafeSystem.cpp b/src/Cafe/CafeSystem.cpp index 5e01abd9..8ec6ff0a 100644 --- a/src/Cafe/CafeSystem.cpp +++ b/src/Cafe/CafeSystem.cpp @@ -209,7 +209,7 @@ void InfoLog_TitleLoaded() fs::path effectiveSavePath = getTitleSavePath(); std::error_code ec; const bool saveDirExists = fs::exists(effectiveSavePath, ec); - cemuLog_force("Save path: {}{}", _utf8Wrapper(effectiveSavePath), saveDirExists ? "" : " (not present)"); + cemuLog_force("Save path: {}{}", _pathToUtf8(effectiveSavePath), saveDirExists ? "" : " (not present)"); // log shader cache name cemuLog_log(LogType::Force, "Shader cache file: shaderCache/transferable/{:016x}.bin", titleId); @@ -617,7 +617,7 @@ namespace CafeSystem sLaunchModeIsStandalone = true; cemuLog_log(LogType::Force, "Launching executable in standalone mode due to incorrect layout or missing meta files"); fs::path executablePath = path; - std::string dirName = _utf8Wrapper(executablePath.parent_path().filename()); + std::string dirName = _pathToUtf8(executablePath.parent_path().filename()); if (boost::iequals(dirName, "code")) { // check for content folder @@ -626,18 +626,18 @@ namespace CafeSystem if (fs::is_directory(contentPath, ec)) { // mounting content folder - bool r = FSCDeviceHostFS_Mount(std::string("/vol/content").c_str(), _utf8Wrapper(contentPath), FSC_PRIORITY_BASE); + bool r = FSCDeviceHostFS_Mount(std::string("/vol/content").c_str(), _pathToUtf8(contentPath), FSC_PRIORITY_BASE); if (!r) { - cemuLog_log(LogType::Force, "Failed to mount {}", _utf8Wrapper(contentPath).c_str()); + cemuLog_log(LogType::Force, "Failed to mount {}", _pathToUtf8(contentPath)); return STATUS_CODE::UNABLE_TO_MOUNT; } } } // mount code folder to a virtual temporary path - FSCDeviceHostFS_Mount(std::string("/internal/code/").c_str(), _utf8Wrapper(executablePath.parent_path()), FSC_PRIORITY_BASE); + FSCDeviceHostFS_Mount(std::string("/internal/code/").c_str(), _pathToUtf8(executablePath.parent_path()), FSC_PRIORITY_BASE); std::string internalExecutablePath = "/internal/code/"; - internalExecutablePath.append(_utf8Wrapper(executablePath.filename())); + internalExecutablePath.append(_pathToUtf8(executablePath.filename())); _pathToExecutable = internalExecutablePath; // since a lot of systems (including save folder location) rely on a TitleId, we derive a placeholder id from the executable hash auto execData = fsc_extractFile(_pathToExecutable.c_str()); diff --git a/src/Cafe/Filesystem/fscDeviceHostFS.cpp b/src/Cafe/Filesystem/fscDeviceHostFS.cpp index bd446f50..da28700d 100644 --- a/src/Cafe/Filesystem/fscDeviceHostFS.cpp +++ b/src/Cafe/Filesystem/fscDeviceHostFS.cpp @@ -127,7 +127,7 @@ bool FSCVirtualFile_Host::fscDirNext(FSCDirEntry* dirEntry) m_dirIterator.reset(new fs::directory_iterator(*m_path)); if (!m_dirIterator) { - cemuLog_force("Failed to iterate directory: {}", _utf8Wrapper(m_path->generic_u8string())); + cemuLog_force("Failed to iterate directory: {}", _pathToUtf8(*m_path)); return false; } } @@ -175,14 +175,14 @@ FSCVirtualFile* FSCVirtualFile_Host::OpenFile(const fs::path& path, FSC_ACCESS_F cemu_assert_debug(writeAccessRequested); fs = FileStream::createFile2(path); if (!fs) - cemuLog_force("FSC: File create failed for {}", _utf8Wrapper(path)); + cemuLog_force("FSC: File create failed for {}", _pathToUtf8(path)); } } else if (HAS_FLAG(accessFlags, FSC_ACCESS_FLAG::FILE_ALWAYS_CREATE)) { fs = FileStream::createFile2(path); if (!fs) - cemuLog_force("FSC: File create failed for {}", _utf8Wrapper(path)); + cemuLog_force("FSC: File create failed for {}", _pathToUtf8(path)); } else { @@ -293,8 +293,8 @@ public: void fscDeviceHostFS_mapBaseDirectories_deprecated() { const auto mlc = ActiveSettings::GetMlcPath(); - fsc_mount("/cemuBossStorage/", _utf8Wrapper(mlc / "usr/boss/"), &fscDeviceHostFSC::instance(), NULL, FSC_PRIORITY_BASE); - fsc_mount("/vol/storage_mlc01/", _utf8Wrapper(mlc / ""), &fscDeviceHostFSC::instance(), NULL, FSC_PRIORITY_BASE); + fsc_mount("/cemuBossStorage/", _pathToUtf8(mlc / "usr/boss/"), &fscDeviceHostFSC::instance(), NULL, FSC_PRIORITY_BASE); + fsc_mount("/vol/storage_mlc01/", _pathToUtf8(mlc / ""), &fscDeviceHostFSC::instance(), NULL, FSC_PRIORITY_BASE); } bool FSCDeviceHostFS_Mount(std::string_view mountPath, std::string_view hostTargetPath, sint32 priority) diff --git a/src/Cafe/GraphicPack/GraphicPack2.cpp b/src/Cafe/GraphicPack/GraphicPack2.cpp index 41e33a19..808536d5 100644 --- a/src/Cafe/GraphicPack/GraphicPack2.cpp +++ b/src/Cafe/GraphicPack/GraphicPack2.cpp @@ -31,12 +31,12 @@ void GraphicPack2::LoadGraphicPack(fs::path graphicPackPath) if (!iniParser.NextSection()) { - cemuLog_force("{}: Does not contain any sections", _utf8Wrapper(rulesPath)); + cemuLog_force("{}: Does not contain any sections", _pathToUtf8(rulesPath)); return; } if (!boost::iequals(iniParser.GetCurrentSectionName(), "Definition")) { - cemuLog_force("{}: [Definition] must be the first section", _utf8Wrapper(rulesPath)); + cemuLog_force("{}: [Definition] must be the first section", _pathToUtf8(rulesPath)); return; } @@ -47,7 +47,7 @@ void GraphicPack2::LoadGraphicPack(fs::path graphicPackPath) auto [ptr, ec] = std::from_chars(option_version->data(), option_version->data() + option_version->size(), versionNum); if (ec != std::errc{}) { - cemuLog_force("{}: Unable to parse version", _utf8Wrapper(rulesPath)); + cemuLog_force("{}: Unable to parse version", _pathToUtf8(rulesPath)); return; } @@ -57,7 +57,7 @@ void GraphicPack2::LoadGraphicPack(fs::path graphicPackPath) return; } } - cemuLog_force("{}: Outdated graphic pack", _utf8Wrapper(rulesPath)); + cemuLog_force("{}: Outdated graphic pack", _pathToUtf8(rulesPath)); } void GraphicPack2::LoadAll() diff --git a/src/Cafe/OS/libs/coreinit/coreinit_FS.cpp b/src/Cafe/OS/libs/coreinit/coreinit_FS.cpp index 2521677c..1598429f 100644 --- a/src/Cafe/OS/libs/coreinit/coreinit_FS.cpp +++ b/src/Cafe/OS/libs/coreinit/coreinit_FS.cpp @@ -109,7 +109,7 @@ namespace coreinit std::error_code ec; const auto path = ActiveSettings::GetPath("sdcard/"); fs::create_directories(path, ec); - FSCDeviceHostFS_Mount("/vol/external01", _utf8Wrapper(path), FSC_PRIORITY_BASE); + FSCDeviceHostFS_Mount("/vol/external01", _pathToUtf8(path), FSC_PRIORITY_BASE); _sdCard01Mounted = true; } @@ -142,7 +142,7 @@ namespace coreinit std::error_code ec; const auto path = ActiveSettings::GetPath("sdcard/"); fs::create_directories(path, ec); - if (!FSCDeviceHostFS_Mount(mountPathOut, _utf8Wrapper(path), FSC_PRIORITY_BASE)) + if (!FSCDeviceHostFS_Mount(mountPathOut, _pathToUtf8(path), FSC_PRIORITY_BASE)) return FS_RESULT::ERR_PLACEHOLDER; _sdCard01Mounted = true; } @@ -150,7 +150,7 @@ namespace coreinit if (_mlc01Mounted) return FS_RESULT::ERR_PLACEHOLDER; - if (!FSCDeviceHostFS_Mount(mountPathOut, _utf8Wrapper(ActiveSettings::GetMlcPath()), FSC_PRIORITY_BASE)) + if (!FSCDeviceHostFS_Mount(mountPathOut, _pathToUtf8(ActiveSettings::GetMlcPath()), FSC_PRIORITY_BASE)) return FS_RESULT::ERR_PLACEHOLDER; _mlc01Mounted = true; } diff --git a/src/Cafe/OS/libs/nn_acp/nn_acp.cpp b/src/Cafe/OS/libs/nn_acp/nn_acp.cpp index 0741619e..3200cf62 100644 --- a/src/Cafe/OS/libs/nn_acp/nn_acp.cpp +++ b/src/Cafe/OS/libs/nn_acp/nn_acp.cpp @@ -51,7 +51,7 @@ namespace acp // mount save path const auto mlc = ActiveSettings::GetMlcPath("usr/save/{:08x}/{:08x}/user/", high, low); - FSCDeviceHostFS_Mount("/vol/save/", _utf8Wrapper(mlc), FSC_PRIORITY_BASE); + FSCDeviceHostFS_Mount("/vol/save/", _pathToUtf8(mlc), FSC_PRIORITY_BASE); nnResult mountResult = BUILD_NN_RESULT(NN_RESULT_LEVEL_SUCCESS, NN_RESULT_MODULE_NN_ACP, 0); return _ACPConvertResultToACPStatus(&mountResult, "ACPMountSaveDir", 0x60); } diff --git a/src/Cafe/TitleList/SaveList.cpp b/src/Cafe/TitleList/SaveList.cpp index 224d47b0..a86e8498 100644 --- a/src/Cafe/TitleList/SaveList.cpp +++ b/src/Cafe/TitleList/SaveList.cpp @@ -66,7 +66,7 @@ void CafeSaveList::RefreshThreadWorker() { if(!it_titleHigh.is_directory(ec)) continue; - std::string dirName = _utf8Wrapper(it_titleHigh.path().filename()); + std::string dirName = _pathToUtf8(it_titleHigh.path().filename()); if(dirName.empty()) continue; uint32 titleIdHigh; @@ -78,7 +78,7 @@ void CafeSaveList::RefreshThreadWorker() { if (!it_titleLow.is_directory(ec)) continue; - dirName = _utf8Wrapper(it_titleLow.path().filename()); + dirName = _pathToUtf8(it_titleLow.path().filename()); if (dirName.empty()) continue; uint32 titleIdLow; diff --git a/src/Cafe/TitleList/TitleInfo.cpp b/src/Cafe/TitleList/TitleInfo.cpp index ef63956f..c58e1841 100644 --- a/src/Cafe/TitleList/TitleInfo.cpp +++ b/src/Cafe/TitleList/TitleInfo.cpp @@ -177,12 +177,12 @@ bool TitleInfo::DetectFormat(const fs::path& path, fs::path& pathOut, TitleDataF std::error_code ec; if (path.has_extension() && fs::is_regular_file(path, ec)) { - std::string filenameStr = _utf8Wrapper(path.filename()); + std::string filenameStr = _pathToUtf8(path.filename()); if (boost::iends_with(filenameStr, ".rpx")) { // is in code folder? fs::path parentPath = path.parent_path(); - if (boost::iequals(_utf8Wrapper(parentPath.filename()), "code")) + if (boost::iequals(_pathToUtf8(parentPath.filename()), "code")) { parentPath = parentPath.parent_path(); // next to content and meta? @@ -370,7 +370,7 @@ bool TitleInfo::Mount(std::string_view virtualPath, std::string_view subfolder, { fs::path hostFSPath = m_fullPath; hostFSPath.append(subfolder); - bool r = FSCDeviceHostFS_Mount(std::string(virtualPath).c_str(), _utf8Wrapper(hostFSPath), mountPriority); + bool r = FSCDeviceHostFS_Mount(std::string(virtualPath).c_str(), _pathToUtf8(hostFSPath), mountPriority); cemu_assert_debug(r); if (!r) { @@ -495,7 +495,7 @@ bool TitleInfo::ParseXmlInfo() if (!m_parsedMetaXml || !m_parsedAppXml || !m_parsedCosXml) { if (hasAnyXml) - cemuLog_log(LogType::Force, "Title has missing meta .xml files. Title path: {}", _utf8Wrapper(m_fullPath)); + cemuLog_log(LogType::Force, "Title has missing meta .xml files. Title path: {}", _pathToUtf8(m_fullPath)); delete m_parsedMetaXml; delete m_parsedAppXml; delete m_parsedCosXml; @@ -621,7 +621,7 @@ std::string TitleInfo::GetPrintPath() const if (!m_isValid) return "invalid"; std::string tmp; - tmp.append(_utf8Wrapper(m_fullPath)); + tmp.append(_pathToUtf8(m_fullPath)); switch (m_titleFormat) { case TitleDataFormat::HOST_FS: diff --git a/src/Cafe/TitleList/TitleList.cpp b/src/Cafe/TitleList/TitleList.cpp index baa4df55..f7c1b6f8 100644 --- a/src/Cafe/TitleList/TitleList.cpp +++ b/src/Cafe/TitleList/TitleList.cpp @@ -120,16 +120,16 @@ void CafeTitleList::StoreCacheFile() titleInfoNode.append_child("region").append_child(pugi::node_pcdata).set_value(fmt::format("{}", (uint32)info.region).c_str()); titleInfoNode.append_child("name").append_child(pugi::node_pcdata).set_value(info.titleName.c_str()); titleInfoNode.append_child("format").append_child(pugi::node_pcdata).set_value(fmt::format("{}", (uint32)info.titleDataFormat).c_str()); - titleInfoNode.append_child("path").append_child(pugi::node_pcdata).set_value(_utf8Wrapper(info.path).c_str()); + titleInfoNode.append_child("path").append_child(pugi::node_pcdata).set_value(_pathToUtf8(info.path).c_str()); if(!info.subPath.empty()) - titleInfoNode.append_child("sub_path").append_child(pugi::node_pcdata).set_value(_utf8Wrapper(info.subPath).c_str()); + titleInfoNode.append_child("sub_path").append_child(pugi::node_pcdata).set_value(_pathToUtf8(info.subPath).c_str()); } - fs::path tmpPath = fs::path(sTLCacheFilePath.parent_path()).append(fmt::format("{}__tmp", _utf8Wrapper(sTLCacheFilePath.filename()))); + fs::path tmpPath = fs::path(sTLCacheFilePath.parent_path()).append(fmt::format("{}__tmp", _pathToUtf8(sTLCacheFilePath.filename()))); std::ofstream fileOut(tmpPath, std::ios::out | std::ios::binary | std::ios::trunc); if (!fileOut.is_open()) { - cemuLog_log(LogType::Force, "Unable to store title list in {}", _utf8Wrapper(tmpPath)); + cemuLog_log(LogType::Force, "Unable to store title list in {}", _pathToUtf8(tmpPath)); return; } doc.save(fileOut, " ", 1, pugi::xml_encoding::encoding_utf8); @@ -158,7 +158,7 @@ void CafeTitleList::SetMLCPath(fs::path path) std::error_code ec; if (!fs::is_directory(path, ec)) { - cemuLog_log(LogType::Force, "MLC set to invalid path: {}", _utf8Wrapper(path)); + cemuLog_log(LogType::Force, "MLC set to invalid path: {}", _pathToUtf8(path)); return; } sTLMLCPath = path; @@ -211,12 +211,12 @@ void _RemoveTitleFromMultimap(TitleInfo* titleInfo) // in the special case that path points to a WUA file, all contained titles will be added void CafeTitleList::AddTitleFromPath(fs::path path) { - if (path.has_extension() && boost::iequals(_utf8Wrapper(path.extension()), ".wua")) + if (path.has_extension() && boost::iequals(_pathToUtf8(path.extension()), ".wua")) { ZArchiveReader* zar = ZArchiveReader::OpenFromFile(path); if (!zar) { - cemuLog_log(LogType::Force, "Found {} but it is not a valid Wii U archive file", _utf8Wrapper(path)); + cemuLog_log(LogType::Force, "Found {} but it is not a valid Wii U archive file", _pathToUtf8(path)); return; } // enumerate all contained titles @@ -233,7 +233,7 @@ void CafeTitleList::AddTitleFromPath(fs::path path) uint16 parsedVersion; if (!TitleInfo::ParseWuaTitleFolderName(dirEntry.name, parsedId, parsedVersion)) { - cemuLog_log(LogType::Force, "Invalid title directory in {}: \"{}\"", _utf8Wrapper(path), dirEntry.name); + cemuLog_log(LogType::Force, "Invalid title directory in {}: \"{}\"", _pathToUtf8(path), dirEntry.name); continue; } // valid subdirectory @@ -351,7 +351,7 @@ void CafeTitleList::ScanGamePath(const fs::path& path) { dirsInDirectory.emplace_back(it.path()); - std::string dirName = _utf8Wrapper(it.path().filename()); + std::string dirName = _pathToUtf8(it.path().filename()); if (boost::iequals(dirName, "content")) hasContentFolder = true; else if (boost::iequals(dirName, "code")) @@ -366,7 +366,7 @@ void CafeTitleList::ScanGamePath(const fs::path& path) // since checking files is slow, we only do it for known file extensions if (!it.has_extension()) continue; - if (!_IsKnownFileExtension(_utf8Wrapper(it.extension()))) + if (!_IsKnownFileExtension(_pathToUtf8(it.extension()))) continue; AddTitleFromPath(it); } @@ -384,7 +384,7 @@ void CafeTitleList::ScanGamePath(const fs::path& path) { for (auto& it : dirsInDirectory) { - std::string dirName = _utf8Wrapper(it.filename()); + std::string dirName = _pathToUtf8(it.filename()); if (!boost::iequals(dirName, "content") && !boost::iequals(dirName, "code") && !boost::iequals(dirName, "meta")) @@ -408,7 +408,7 @@ void CafeTitleList::ScanMLCPath(const fs::path& path) if (!it.is_directory()) continue; // only scan directories which match the title id naming scheme - std::string dirName = _utf8Wrapper(it.path().filename()); + std::string dirName = _pathToUtf8(it.path().filename()); if(dirName.size() != 8) continue; bool containsNoHexCharacter = false; diff --git a/src/Common/precompiled.h b/src/Common/precompiled.h index 9581861b..57f69c57 100644 --- a/src/Common/precompiled.h +++ b/src/Common/precompiled.h @@ -420,21 +420,14 @@ inline std::string_view _utf8Wrapper(std::u8string_view input) return v; } -// returns a std::u8string as std::string, the contents are left as-is -inline std::string _utf8Wrapper(const std::u8string& u8str) +// convert fs::path to utf8 encoded string +inline std::string _pathToUtf8(const fs::path& path) { - std::string v; - v.resize(u8str.size()); - memcpy(v.data(), u8str.data(), u8str.size()); + std::u8string strU8 = path.generic_u8string(); + std::string v((const char*)strU8.data(), strU8.size()); return v; } -// get utf8 generic path string directly from std::filesystem::path -inline std::string _utf8Wrapper(const fs::path& path) -{ - return _utf8Wrapper(path.generic_u8string()); -} - // convert utf8 encoded string to fs::path inline fs::path _utf8ToPath(std::string_view input) { diff --git a/src/config/CemuConfig.cpp b/src/config/CemuConfig.cpp index bc1f9f97..31a3b3e2 100644 --- a/src/config/CemuConfig.cpp +++ b/src/config/CemuConfig.cpp @@ -417,7 +417,7 @@ void CemuConfig::Save(XMLConfigParser& parser) for (const auto& game : graphic_pack_entries) { auto entry = graphic_pack_parser.set("Entry"); - entry.set_attribute("filename",_utf8Wrapper(game.first).c_str()); + entry.set_attribute("filename",_pathToUtf8(game.first).c_str()); for(const auto& kv : game.second) { // TODO: less hacky pls diff --git a/src/gui/GameUpdateWindow.cpp b/src/gui/GameUpdateWindow.cpp index c689dd6f..3ea3f9d1 100644 --- a/src/gui/GameUpdateWindow.cpp +++ b/src/gui/GameUpdateWindow.cpp @@ -251,7 +251,7 @@ void GameUpdateWindow::ThreadWork() error_msg << GetSystemErrorMessage(ex); if(currentDirEntry != fs::directory_entry{}) - error_msg << fmt::format("\n{}\n{}",_("Current file:").ToStdString(), _utf8Wrapper(currentDirEntry.path())); + error_msg << fmt::format("\n{}\n{}",_("Current file:").ToStdString(), _pathToUtf8(currentDirEntry.path())); m_thread_exception = error_msg.str(); m_thread_state = ThreadCanceled; diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index 53363ae3..5b65c7a1 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -1947,7 +1947,7 @@ public: "/*****************************************************************************/\r\n" ); delete fs; - wxLaunchDefaultBrowser(wxHelper::FromUtf8(fmt::format("file:{}", _utf8Wrapper(tempPath)))); + wxLaunchDefaultBrowser(wxHelper::FromUtf8(fmt::format("file:{}", _pathToUtf8(tempPath)))); }); lineSizer->Add(noticeLink, 0); lineSizer->Add(new wxStaticText(parent, -1, ")"), 0); diff --git a/src/gui/MemorySearcherTool.cpp b/src/gui/MemorySearcherTool.cpp index 904be1a0..3423e73b 100644 --- a/src/gui/MemorySearcherTool.cpp +++ b/src/gui/MemorySearcherTool.cpp @@ -275,7 +275,7 @@ void MemorySearcherTool::Load() if (!memSearcherIniContents) return; - IniParser iniParser(*memSearcherIniContents, _utf8Wrapper(memorySearcherPath)); + IniParser iniParser(*memSearcherIniContents, _pathToUtf8(memorySearcherPath)); while (iniParser.NextSection()) { auto option_description = iniParser.FindOption("description"); diff --git a/src/gui/TitleManager.cpp b/src/gui/TitleManager.cpp index b643ab8f..657fa3ce 100644 --- a/src/gui/TitleManager.cpp +++ b/src/gui/TitleManager.cpp @@ -480,7 +480,7 @@ void TitleManager::OnSaveOpenDirectory(wxCommandEvent& event) if (!fs::exists(target) || !fs::is_directory(target)) return; - wxLaunchDefaultBrowser(wxHelper::FromUtf8(fmt::format("file:{}", _utf8Wrapper(target)))); + wxLaunchDefaultBrowser(wxHelper::FromUtf8(fmt::format("file:{}", _pathToUtf8(target)))); } void TitleManager::OnSaveDelete(wxCommandEvent& event) diff --git a/src/gui/components/wxGameList.cpp b/src/gui/components/wxGameList.cpp index 68dde7c6..39eeb100 100644 --- a/src/gui/components/wxGameList.cpp +++ b/src/gui/components/wxGameList.cpp @@ -563,7 +563,7 @@ void wxGameList::OnContextMenuSelected(wxCommandEvent& event) { fs::path path(gameInfo.GetBase().GetPath()); _stripPathFilename(path); - wxLaunchDefaultBrowser(wxHelper::FromUtf8(fmt::format("file:{}", _utf8Wrapper(path)))); + wxLaunchDefaultBrowser(wxHelper::FromUtf8(fmt::format("file:{}", _pathToUtf8(path)))); break; } case kWikiPage: @@ -584,21 +584,21 @@ void wxGameList::OnContextMenuSelected(wxCommandEvent& event) case kContextMenuSaveFolder: { - wxLaunchDefaultBrowser(wxHelper::FromUtf8(fmt::format("file:{}", _utf8Wrapper(gameInfo.GetSaveFolder())))); + wxLaunchDefaultBrowser(wxHelper::FromUtf8(fmt::format("file:{}", _pathToUtf8(gameInfo.GetSaveFolder())))); break; } case kContextMenuUpdateFolder: { fs::path path(gameInfo.GetUpdate().GetPath()); _stripPathFilename(path); - wxLaunchDefaultBrowser(wxHelper::FromUtf8(fmt::format("file:{}", _utf8Wrapper(path)))); + wxLaunchDefaultBrowser(wxHelper::FromUtf8(fmt::format("file:{}", _pathToUtf8(path)))); break; } case kContextMenuDLCFolder: { fs::path path(gameInfo.GetAOC().front().GetPath()); _stripPathFilename(path); - wxLaunchDefaultBrowser(wxHelper::FromUtf8(fmt::format("file:{}", _utf8Wrapper(path)))); + wxLaunchDefaultBrowser(wxHelper::FromUtf8(fmt::format("file:{}", _pathToUtf8(path)))); break; } case kContextMenuEditGraphicPacks: diff --git a/src/gui/components/wxTitleManagerList.cpp b/src/gui/components/wxTitleManagerList.cpp index 57e9ee22..7252d872 100644 --- a/src/gui/components/wxTitleManagerList.cpp +++ b/src/gui/components/wxTitleManagerList.cpp @@ -293,21 +293,21 @@ void wxTitleManagerList::OnConvertToCompressedFormat(uint64 titleId) std::string msg = wxHelper::MakeUTF8(_("The following content will be converted to a compressed Wii U archive file (.wua):\n \n")); if (titleInfo_base.IsValid()) - msg.append(fmt::format(fmt::runtime(wxHelper::MakeUTF8(_("Base game: {}"))), _utf8Wrapper(titleInfo_base.GetPath()))); + msg.append(fmt::format(fmt::runtime(wxHelper::MakeUTF8(_("Base game: {}"))), _pathToUtf8(titleInfo_base.GetPath()))); else msg.append(fmt::format(fmt::runtime(wxHelper::MakeUTF8(_("Base game: Not installed"))))); msg.append("\n"); if (titleInfo_update.IsValid()) - msg.append(fmt::format(fmt::runtime(wxHelper::MakeUTF8(_("Update: {}"))), _utf8Wrapper(titleInfo_update.GetPath()))); + msg.append(fmt::format(fmt::runtime(wxHelper::MakeUTF8(_("Update: {}"))), _pathToUtf8(titleInfo_update.GetPath()))); else msg.append(fmt::format(fmt::runtime(wxHelper::MakeUTF8(_("Update: Not installed"))))); msg.append("\n"); if (titleInfo_aoc.IsValid()) - msg.append(fmt::format(fmt::runtime(wxHelper::MakeUTF8(_("DLC: {}"))), _utf8Wrapper(titleInfo_aoc.GetPath()))); + msg.append(fmt::format(fmt::runtime(wxHelper::MakeUTF8(_("DLC: {}"))), _pathToUtf8(titleInfo_aoc.GetPath()))); else msg.append(fmt::format(fmt::runtime(wxHelper::MakeUTF8(_("DLC: Not installed"))))); @@ -778,9 +778,9 @@ bool wxTitleManagerList::DeleteEntry(long index, const TitleEntry& entry) wxString msg; const bool is_directory = fs::is_directory(entry.path); if(is_directory) - msg = wxStringFormat2(_("Are you really sure that you want to delete the following folder:\n{}"), wxHelper::FromUtf8(_utf8Wrapper(entry.path))); + msg = wxStringFormat2(_("Are you really sure that you want to delete the following folder:\n{}"), wxHelper::FromUtf8(_pathToUtf8(entry.path))); else - msg = wxStringFormat2(_("Are you really sure that you want to delete the following file:\n{}"), wxHelper::FromUtf8(_utf8Wrapper(entry.path))); + msg = wxStringFormat2(_("Are you really sure that you want to delete the following file:\n{}"), wxHelper::FromUtf8(_pathToUtf8(entry.path))); const auto result = wxMessageBox(msg, _("Warning"), wxYES_NO | wxCENTRE | wxICON_EXCLAMATION, this); if (result == wxNO) @@ -852,7 +852,7 @@ void wxTitleManagerList::OnContextMenuSelected(wxCommandEvent& event) case kContextMenuOpenDirectory: { const auto path = fs::is_directory(entry->path) ? entry->path : entry->path.parent_path(); - wxLaunchDefaultBrowser(wxHelper::FromUtf8(fmt::format("file:{}", _utf8Wrapper(path)))); + wxLaunchDefaultBrowser(wxHelper::FromUtf8(fmt::format("file:{}", _pathToUtf8(path)))); } break; case kContextMenuDelete: diff --git a/src/gui/dialogs/SaveImport/SaveImportWindow.cpp b/src/gui/dialogs/SaveImport/SaveImportWindow.cpp index bfdb00b4..9b7b20cc 100644 --- a/src/gui/dialogs/SaveImport/SaveImportWindow.cpp +++ b/src/gui/dialogs/SaveImport/SaveImportWindow.cpp @@ -170,7 +170,7 @@ void SaveImportWindow::OnImport(wxCommandEvent& event) { if (!fs::is_directory(target_path)) { - const auto msg = wxStringFormat2(_("There's already a file at the target directory:\n{}"), _utf8Wrapper(target_path)); + const auto msg = wxStringFormat2(_("There's already a file at the target directory:\n{}"), _pathToUtf8(target_path)); wxMessageBox(msg, _("Error"), wxOK | wxCENTRE | wxICON_ERROR, this); m_return_code = wxCANCEL; Close(); diff --git a/src/gui/dialogs/SaveImport/SaveTransfer.cpp b/src/gui/dialogs/SaveImport/SaveTransfer.cpp index bcccf1dd..ad11fba6 100644 --- a/src/gui/dialogs/SaveImport/SaveTransfer.cpp +++ b/src/gui/dialogs/SaveImport/SaveTransfer.cpp @@ -108,7 +108,7 @@ void SaveTransfer::OnTransfer(wxCommandEvent& event) { if(!fs::is_directory(target_path)) { - const auto msg = wxStringFormat2(_("There's already a file at the target directory:\n{}"), _utf8Wrapper(target_path)); + const auto msg = wxStringFormat2(_("There's already a file at the target directory:\n{}"), _pathToUtf8(target_path)); wxMessageBox(msg, _("Error"), wxOK | wxCENTRE | wxICON_ERROR, this); m_return_code = wxCANCEL; Close(); diff --git a/src/main.cpp b/src/main.cpp index f94b2761..67b640b4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -166,7 +166,7 @@ void reconfigureGLDrivers() fs::create_directories(nvCacheDir, err); std::string nvCacheDirEnvOption("__GL_SHADER_DISK_CACHE_PATH="); - nvCacheDirEnvOption.append(_utf8Wrapper(nvCacheDir)); + nvCacheDirEnvOption.append(_pathToUtf8(nvCacheDir)); #if BOOST_OS_WINDOWS std::wstring tmpW = boost::nowide::widen(nvCacheDirEnvOption);