mirror of
https://github.com/mitch030504/Wiicompiled_VR_Frame.git
synced 2026-10-06 06:00:25 +02:00
Use UTF-8-safe filesystem paths end-to-end
This commit is contained in:
1 parent
4897e7e27d
commit
b5e5858e1d
26 files changed
+334
-306
No files matched your search
@@ -27,13 +27,14 @@ inline std::optional<std::filesystem::path> ExistingDirectory(const std::filesys
|
||||
if (path.empty()) {
|
||||
RT_LOGF(RT_TAG_NAND, "ERROR: %s\n", message);
|
||||
} else {
|
||||
RT_LOGF(RT_TAG_NAND, "ERROR: %s: %s\n", message, path.string().c_str());
|
||||
RT_LOGF(RT_TAG_NAND, "ERROR: %s: %s\n", message,
|
||||
RuntimeConfigFile::PathToUtf8(path).c_str());
|
||||
}
|
||||
RT_LOGF(RT_TAG_NAND, "Set [paths] nand_root in Config.toml.\n");
|
||||
std::string details = message ? message : "The configured NAND could not be initialized.";
|
||||
if (!path.empty()) {
|
||||
details += "\n\nPath: ";
|
||||
details += path.string();
|
||||
details += RuntimeConfigFile::PathToUtf8(path);
|
||||
}
|
||||
details += "\n\nSet [paths] nand_root in Config.toml and try again.";
|
||||
// Same fatal idiom as the DVD and OS paths: crash artifacts first so the run
|
||||
@@ -51,18 +52,6 @@ inline std::filesystem::path ResolveConfiguredPath(const std::string& value) {
|
||||
return RuntimeConfigFile::ResolveRelativeToConfig(value);
|
||||
}
|
||||
|
||||
inline std::string PathStringWithoutTrailingSeparators(std::filesystem::path path) {
|
||||
std::string text = path.string();
|
||||
while (!text.empty()) {
|
||||
const char tail = text.back();
|
||||
if (tail != '\\' && tail != '/') {
|
||||
break;
|
||||
}
|
||||
text.pop_back();
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
inline std::filesystem::path ManagedNandRootPath() {
|
||||
return RuntimeConfigFile::ApplicationDataDirectory() / "NAND";
|
||||
}
|
||||
@@ -134,7 +123,9 @@ inline bool SeedMissingBootstrapFiles(const std::filesystem::path& root) {
|
||||
const std::filesystem::path relativePath{std::string(file)};
|
||||
ec.clear();
|
||||
if (!CopyBootstrapFile(*payload, root, relativePath, ec)) {
|
||||
RT_LOG(RT_TAG_NAND) << "could not create " << (root / relativePath).string() << std::endl;
|
||||
RT_LOG(RT_TAG_NAND) << "could not create "
|
||||
<< RuntimeConfigFile::PathToUtf8(root / relativePath)
|
||||
<< std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -167,7 +158,8 @@ inline std::filesystem::path CreateManagedNandRoot() {
|
||||
}
|
||||
}
|
||||
|
||||
RT_LOG(RT_TAG_NAND) << "using managed NAND root: " << root.string() << std::endl;
|
||||
RT_LOG(RT_TAG_NAND) << "using managed NAND root: " << RuntimeConfigFile::PathToUtf8(root)
|
||||
<< std::endl;
|
||||
return root;
|
||||
}
|
||||
|
||||
@@ -187,8 +179,4 @@ inline std::filesystem::path DiscoverNandRootPath() {
|
||||
return CreateManagedNandRoot();
|
||||
}
|
||||
|
||||
inline std::string DiscoverNandRootString() {
|
||||
return PathStringWithoutTrailingSeparators(DiscoverNandRootPath());
|
||||
}
|
||||
|
||||
} // namespace RuntimeNandPath
|
||||
Reference in new issue
Block a user