mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 06:39:12 +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;
|
function FileSize(const Filename: string): int64;
|
||||||
{$IFDEF Unix}
|
{$IFDEF Unix}
|
||||||
var
|
var
|
||||||
st : baseunix.stat;
|
st: baseunix.stat;
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
var
|
var
|
||||||
FileInfo: TSearchRec;
|
FileInfo: TSearchRec;
|
||||||
@ -839,11 +839,13 @@ begin
|
|||||||
exit(-1);
|
exit(-1);
|
||||||
Result:=st.st_size;
|
Result:=st.st_size;
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
if FindFirstUTF8(Filename,faAnyFile,FileInfo)=0 then begin
|
FileInfo.Name:=UTF8ToSys(Filename);
|
||||||
Result:=FileInfo.Size;
|
FileInfo.FindHandle:=Windows.FindFirstFile(PChar(FileInfo.Name),FileInfo.FindData);
|
||||||
end else
|
if FileInfo.FindHandle=Windows.Invalid_Handle_value then begin
|
||||||
Result:=-1;
|
Result:=Windows.GetLastError;
|
||||||
FindCloseUTF8(FileInfo);
|
exit;
|
||||||
|
end;
|
||||||
|
Result:=(int64(FileInfo.FindData.nFileSizeHigh) shl 32)+FileInfo.FindData.nFileSizeLow;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user