mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-05-19 05:37:00 +02:00
fix stat being wrong
This commit is contained in:
parent
5a402ab6c7
commit
f48a684074
1 changed files with 12 additions and 10 deletions
|
|
@ -20,6 +20,9 @@
|
|||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#ifdef __OPENORBIS__
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define fileno _fileno
|
||||
|
|
@ -402,28 +405,27 @@ u64 IOFile::GetSize() const {
|
|||
file_size = Android::GetSize(file_path);
|
||||
} else {
|
||||
std::error_code ec;
|
||||
|
||||
file_size = fs::file_size(file_path, ec);
|
||||
|
||||
if (ec) {
|
||||
LOG_ERROR(Common_Filesystem,
|
||||
"Failed to retrieve the file size of path={}, ec_message={}",
|
||||
PathToUTF8String(file_path), ec.message());
|
||||
LOG_ERROR(Common_Filesystem, "Failed to retrieve the file size of path={}, ec_message={}", PathToUTF8String(file_path), ec.message());
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#elif defined(__OPENORBIS__)
|
||||
// TODO: implementation of fs::file_size() is buggy on PS4, why?
|
||||
// probably toolchain issue... ugh
|
||||
OrbisKernelStat st{};
|
||||
stat(file_path.c_str(), reinterpret_cast<struct stat *>(std::addressof(st)));
|
||||
auto const file_size = st.st_size;
|
||||
LOG_DEBUG(Common_Filesystem, "size for {} = {}", file_path.c_str(), file_size);
|
||||
#else
|
||||
std::error_code ec;
|
||||
|
||||
const auto file_size = fs::file_size(file_path, ec);
|
||||
|
||||
if (ec) {
|
||||
LOG_ERROR(Common_Filesystem, "Failed to retrieve the file size of path={}, ec_message={}",
|
||||
PathToUTF8String(file_path), ec.message());
|
||||
LOG_ERROR(Common_Filesystem, "Failed to retrieve the file size of path={}, ec_message={}", PathToUTF8String(file_path), ec.message());
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
return file_size;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue