From 69d6be09f7084444bc90d5fb6174d8532d5bd51c Mon Sep 17 00:00:00 2001 From: "Admiral H. Curtiss" Date: Fri, 31 Mar 2023 19:50:00 +0200 Subject: [PATCH] IOS/FS: GetDirectoryStats() should return an error if the given path is not a directory. --- Source/Core/Core/IOS/FS/HostBackend/FS.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Source/Core/Core/IOS/FS/HostBackend/FS.cpp b/Source/Core/Core/IOS/FS/HostBackend/FS.cpp index 2b2cf16be1..cf9a50396e 100644 --- a/Source/Core/Core/IOS/FS/HostBackend/FS.cpp +++ b/Source/Core/Core/IOS/FS/HostBackend/FS.cpp @@ -771,7 +771,12 @@ Result HostFileSystem::GetDirectoryStats(const std::string& wii_ DirectoryStats stats{}; std::string path(BuildFilename(wii_path).host_path); - if (File::IsDirectory(path)) + File::FileInfo info(path); + if (!info.Exists()) + { + return ResultCode::NotFound; + } + if (info.IsDirectory()) { File::FSTEntry parent_dir = File::ScanDirectoryTree(path, true); // add one for the folder itself @@ -783,7 +788,7 @@ Result HostFileSystem::GetDirectoryStats(const std::string& wii_ } else { - WARN_LOG_FMT(IOS_FS, "fsBlock failed, cannot find directory: {}", path); + return ResultCode::Invalid; } return stats; }