Rename path _utf8Wrapper to _utf8ToPath for better clarity

This commit is contained in:
Exzap 2022-09-09 23:48:52 +02:00
parent 168ecf8825
commit 680beaaf21
19 changed files with 60 additions and 67 deletions

View file

@ -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;