Fix file size on unix systems if file is missing

This commit is contained in:
Wojtek Figat
2023-04-28 23:55:11 +02:00
parent b6ceed5c6d
commit 385ef7361c
3 changed files with 6 additions and 6 deletions

View File

@@ -249,13 +249,13 @@ bool AndroidFileSystem::DeleteFile(const StringView& path)
uint64 AndroidFileSystem::GetFileSize(const StringView& path)
{
struct stat fileInfo;
fileInfo.st_size = -1;
fileInfo.st_size = 0;
const StringAsANSI<> pathANSI(*path, path.Length());
if (stat(pathANSI.Get(), &fileInfo) != -1)
{
if (S_ISDIR(fileInfo.st_mode))
{
fileInfo.st_size = -1;
fileInfo.st_size = 0;
}
}
else