mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-11 13:37:45 +02:00
LCL: FileSize fixed for files bigger than 2GB
git-svn-id: trunk@16747 -
This commit is contained in:
parent
7a92f9cadc
commit
c48ce44f60
@ -828,7 +828,7 @@ end;
|
||||
function FileSize(const Filename: string): int64;
|
||||
{$IFDEF Unix}
|
||||
var
|
||||
st : baseunix.stat;
|
||||
st: baseunix.stat;
|
||||
{$ELSE}
|
||||
var
|
||||
FileInfo: TSearchRec;
|
||||
@ -839,11 +839,13 @@ begin
|
||||
exit(-1);
|
||||
Result:=st.st_size;
|
||||
{$ELSE}
|
||||
if FindFirstUTF8(Filename,faAnyFile,FileInfo)=0 then begin
|
||||
Result:=FileInfo.Size;
|
||||
end else
|
||||
Result:=-1;
|
||||
FindCloseUTF8(FileInfo);
|
||||
FileInfo.Name:=UTF8ToSys(Filename);
|
||||
FileInfo.FindHandle:=Windows.FindFirstFile(PChar(FileInfo.Name),FileInfo.FindData);
|
||||
if FileInfo.FindHandle=Windows.Invalid_Handle_value then begin
|
||||
Result:=Windows.GetLastError;
|
||||
exit;
|
||||
end;
|
||||
Result:=(int64(FileInfo.FindData.nFileSizeHigh) shl 32)+FileInfo.FindData.nFileSizeLow;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user