mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-07 04:18:48 +02:00
Fixes FileUtil.FileSize for wince and adds unicode filename support in win32
git-svn-id: trunk@21243 -
This commit is contained in:
parent
8cb3925298
commit
deead46265
@ -840,30 +840,31 @@ function FileSize(const Filename: string): int64;
|
||||
{$IFDEF Unix}
|
||||
var
|
||||
st: baseunix.stat;
|
||||
{$ELSE}
|
||||
var
|
||||
FileInfo: TSearchRec;
|
||||
{$ENDIF}
|
||||
begin
|
||||
{$IFDEF Unix}
|
||||
if not fpstat(pointer(Filename),st)>=0 then
|
||||
exit(-1);
|
||||
Result:=st.st_size;
|
||||
{$ELSE}
|
||||
{$IFDEF WINCE}
|
||||
FileInfo.Name:=UTF8Decode(Filename);
|
||||
{$ELSE}
|
||||
FileInfo.Name:=UTF8ToSys(Filename);
|
||||
{$ENDIF}
|
||||
FileInfo.FindHandle:=Windows.FindFirstFile(Windows.LPTSTR(FileInfo.Name),FileInfo.FindData);
|
||||
if FileInfo.FindHandle=Windows.Invalid_Handle_value then begin
|
||||
end;
|
||||
{$ELSE}
|
||||
var
|
||||
FindData: TWIN32FindDataW;
|
||||
FindHandle: THandle;
|
||||
Str: widestring;
|
||||
begin
|
||||
// Fix for the bug 14360:
|
||||
// Don't assign the widestring to TSearchRec.name because it is of type
|
||||
// string, which will generate a conversion to the system encoding
|
||||
Str := UTF8Decode(Filename);
|
||||
FindHandle:=Windows.FindFirstFileW(PWideChar(Str), FindData);
|
||||
if FindHandle=Windows.Invalid_Handle_value then
|
||||
begin
|
||||
Result:=-1;
|
||||
exit;
|
||||
end;
|
||||
Result:=(int64(FileInfo.FindData.nFileSizeHigh) shl 32)+FileInfo.FindData.nFileSizeLow;
|
||||
Windows.FindClose(FileInfo.FindHandle);
|
||||
{$ENDIF}
|
||||
Result:=(int64(FindData.nFileSizeHigh) shl 32)+FindData.nFileSizeLow;
|
||||
Windows.FindClose(FindHandle);
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
GetFileDescription
|
||||
|
@ -31,7 +31,7 @@ uses
|
||||
Windows,
|
||||
// LCL
|
||||
ShellCtrls, Forms, Dialogs, FileCtrl, Controls, ComCtrls,
|
||||
LResources, ExtCtrls, Buttons, Graphics,
|
||||
LResources, ExtCtrls, Buttons, Graphics, StdCtrls,
|
||||
// Widgetset
|
||||
WSDialogs, WSLCLClasses, InterfaceBase;
|
||||
|
||||
@ -187,6 +187,7 @@ begin
|
||||
ShellListView.Width := Width;
|
||||
ShellListView.Height := Height - ShellTreeView.Height - Panel.Height;
|
||||
ShellListView.ShellTreeView := ShellTreeView;
|
||||
ShellListView.ScrollBars := ssNone;
|
||||
end;
|
||||
|
||||
procedure TWinCEFileDialogForm.HandleOkClick(ASender: TObject);
|
||||
|
@ -520,6 +520,7 @@ begin
|
||||
begin
|
||||
FRoot := Value;
|
||||
Clear;
|
||||
Items.Clear;
|
||||
PopulateWithRoot();
|
||||
end;
|
||||
end;
|
||||
@ -551,15 +552,14 @@ begin
|
||||
inherited Create(AOwner);
|
||||
|
||||
// Initial property values
|
||||
|
||||
ViewStyle := vsReport;
|
||||
ObjectTypes := [otNonFolders];
|
||||
|
||||
Self.Columns.Clear;
|
||||
Self.Columns.Add;
|
||||
Self.Columns.Add;
|
||||
Self.Columns.Add;
|
||||
Self.Column[0].Caption := 'Name';
|
||||
Self.Columns.Add;
|
||||
Self.Column[1].Caption := 'Size';
|
||||
Self.Columns.Add;
|
||||
Self.Column[2].Caption := 'Type';
|
||||
// Initial sizes, necessary under Windows CE
|
||||
HandleResize(Self);
|
||||
|
Loading…
Reference in New Issue
Block a user