mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-20 10:56:58 +02:00
Add unicode path regression coverage
This commit is contained in:
+1
-1
@@ -238,7 +238,7 @@ static bool ParseArgs(int argc, char* argv[], RunOptions& options, bool& show_he
|
|||||||
::printf("--game-patch must point to an existing file: %s\n", value.c_str());
|
::printf("--game-patch must point to an existing file: %s\n", value.c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
options.game_patch = value;
|
options.game_patch = path;
|
||||||
} else if (arg == "--screen-width") {
|
} else if (arg == "--screen-width") {
|
||||||
options.config.screen_width = static_cast<uint32_t>(Common::ToInt32(value));
|
options.config.screen_width = static_cast<uint32_t>(Common::ToInt32(value));
|
||||||
} else if (arg == "--screen-height") {
|
} else if (arg == "--screen-height") {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "common/subsystems.h"
|
#include "common/subsystems.h"
|
||||||
#include "common/threads.h"
|
#include "common/threads.h"
|
||||||
|
#include "common/stringUtils.h"
|
||||||
#include "graphics/presentation/window/windowInternal.h"
|
#include "graphics/presentation/window/windowInternal.h"
|
||||||
#include "kernel/fileSystem.h"
|
#include "kernel/fileSystem.h"
|
||||||
#include "libs/errno.h"
|
#include "libs/errno.h"
|
||||||
@@ -128,6 +129,43 @@ void CheckMountRoot(const std::filesystem::path &root) {
|
|||||||
FileSystem::Umount("/app0");
|
FileSystem::Umount("/app0");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CheckUnicodePaths(const std::filesystem::path &root) {
|
||||||
|
constexpr std::string_view HostDirectory =
|
||||||
|
"Test\xc3\xa9-\xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e";
|
||||||
|
constexpr std::string_view GuestFilename =
|
||||||
|
"asset-\xc3\xa9-\xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e.bin";
|
||||||
|
|
||||||
|
const auto unicode_root =
|
||||||
|
root / Common::PathFromUtf8(HostDirectory);
|
||||||
|
|
||||||
|
Check(std::filesystem::create_directories(unicode_root),
|
||||||
|
"create Unicode host directory");
|
||||||
|
|
||||||
|
CheckMountRoot(unicode_root);
|
||||||
|
|
||||||
|
const auto native_file =
|
||||||
|
unicode_root / Common::PathFromUtf8(GuestFilename);
|
||||||
|
|
||||||
|
Common::File fixture;
|
||||||
|
Check(fixture.Create(native_file), "create Unicode filename");
|
||||||
|
fixture.Close();
|
||||||
|
|
||||||
|
FileSystem::Mount(unicode_root, "/app0");
|
||||||
|
|
||||||
|
const auto guest_file =
|
||||||
|
std::string("/app0/") + std::string(GuestFilename);
|
||||||
|
|
||||||
|
Check(FileSystem::GetRealFilename(guest_file) == native_file,
|
||||||
|
"resolve Unicode guest path");
|
||||||
|
|
||||||
|
const int fd = FileSystem::KernelOpen(guest_file.c_str(), 0, 0);
|
||||||
|
Check(fd >= 3, "open Unicode guest path");
|
||||||
|
Check(FileSystem::KernelClose(fd) == OK,
|
||||||
|
"close Unicode guest path");
|
||||||
|
|
||||||
|
FileSystem::Umount("/app0");
|
||||||
|
}
|
||||||
|
|
||||||
void CheckDirectoryStream(const std::filesystem::path &root) {
|
void CheckDirectoryStream(const std::filesystem::path &root) {
|
||||||
const auto directory = root / "directory-stream";
|
const auto directory = root / "directory-stream";
|
||||||
Check(std::filesystem::create_directory(directory),
|
Check(std::filesystem::create_directory(directory),
|
||||||
@@ -387,6 +425,7 @@ int main() {
|
|||||||
TempDirectory temporary;
|
TempDirectory temporary;
|
||||||
FileSystem::Initialize();
|
FileSystem::Initialize();
|
||||||
CheckMountRoot(temporary.Path());
|
CheckMountRoot(temporary.Path());
|
||||||
|
CheckUnicodePaths(temporary.Path());
|
||||||
CheckDirectoryStream(temporary.Path());
|
CheckDirectoryStream(temporary.Path());
|
||||||
CheckAprPaths(temporary.Path());
|
CheckAprPaths(temporary.Path());
|
||||||
FileSystem::Mount(temporary.Path(), "/savedata0");
|
FileSystem::Mount(temporary.Path(), "/savedata0");
|
||||||
|
|||||||
Reference in New Issue
Block a user