mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-10 01:28:44 +02:00
Merge pull request #398 from Pouare514/fix/libc-fopen-enoent
fix(libc): return NULL with ENOENT for missing files in fopen
This commit is contained in:
@@ -41,7 +41,12 @@ FileStream* APS5_VABI fopen_nid_postfix(const char* filename, const char* mode)
|
||||
const auto abs_path = fpath.string();
|
||||
std::unique_ptr<std::FILE, decltype(&std::fclose)> handle(std::fopen(abs_path.c_str(), mode), std::fclose);
|
||||
if (!handle) {
|
||||
const auto reason = std::strerror(errno);
|
||||
const int error = errno;
|
||||
if (error == ENOENT) {
|
||||
errno = error;
|
||||
return nullptr;
|
||||
}
|
||||
const auto reason = std::strerror(error);
|
||||
std::error_code ec;
|
||||
std::filesystem::path sibling;
|
||||
for (const auto& entry : std::filesystem::directory_iterator(fpath.parent_path(), ec)) {
|
||||
|
||||
Reference in New Issue
Block a user