mirror of
https://github.com/love2d/love.git
synced 2026-08-17 19:23:38 +02:00
NativeFile: Temporarily open the file for reading to determine file size.
This commit is contained in:
@@ -121,10 +121,16 @@ bool NativeFile::isOpen() const
|
|||||||
|
|
||||||
int64 NativeFile::getSize()
|
int64 NativeFile::getSize()
|
||||||
{
|
{
|
||||||
|
int64 size = -1;
|
||||||
if (!file)
|
if (!file)
|
||||||
return -1;
|
{
|
||||||
|
open(MODE_READ);
|
||||||
|
size = SDL_GetIOSize(file);
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
size = SDL_GetIOSize(file);
|
||||||
|
|
||||||
int64 size = SDL_GetIOSize(file);
|
|
||||||
return std::max<int64>(size, -1);
|
return std::max<int64>(size, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user