mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-27 12:00:29 +02:00
LazUtils: Fix implicit codepage ceversion issue for FindFirstUtf8/FindNextUtf8 (Windows). Patch by Michl. Issue #0028406.
git-svn-id: trunk@50567 -
This commit is contained in:
parent
6328571bef
commit
a121cb2acc
@ -544,10 +544,6 @@ end;
|
|||||||
{$IFEND}
|
{$IFEND}
|
||||||
|
|
||||||
function FindMatch(var f: TSearchRec) : Longint;
|
function FindMatch(var f: TSearchRec) : Longint;
|
||||||
{$IFDEF ACP_RTL}
|
|
||||||
var
|
|
||||||
Dummy: String;
|
|
||||||
{$ENDIF}
|
|
||||||
begin
|
begin
|
||||||
{ Find file with correct attribute }
|
{ Find file with correct attribute }
|
||||||
While (F.FindData.dwFileAttributes and cardinal(F.ExcludeAttr))<>0 do
|
While (F.FindData.dwFileAttributes and cardinal(F.ExcludeAttr))<>0 do
|
||||||
@ -566,12 +562,10 @@ begin
|
|||||||
in win32 it is the ansi structure with a utf-8 string
|
in win32 it is the ansi structure with a utf-8 string
|
||||||
in wince it is a wide structure }
|
in wince it is a wide structure }
|
||||||
{$ifdef FindData_W}
|
{$ifdef FindData_W}
|
||||||
{$IFnDEF ACP_RTL}
|
{$IFDEF ACP_RTL}
|
||||||
f.Name:=UTF8Encode(UnicodeString(F.FindData.cFileName));
|
f.Name:=String(UnicodeString(F.FindData.cFileName));
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
Dummy := '';
|
f.Name:=UTF8Encode(UnicodeString(F.FindData.cFileName));
|
||||||
Insert(UTF8Encode(UnicodeString(F.FindData.cFileName)), Dummy, 1);
|
|
||||||
f.Name := Dummy;
|
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
{$else}
|
{$else}
|
||||||
f.Name:=F.FindData.cFileName;
|
f.Name:=F.FindData.cFileName;
|
||||||
@ -624,7 +618,11 @@ begin
|
|||||||
Rslt.ExcludeAttr:=(not Attr) and ($1e);
|
Rslt.ExcludeAttr:=(not Attr) and ($1e);
|
||||||
{ $1e = faHidden or faSysFile or faVolumeID or faDirectory }
|
{ $1e = faHidden or faSysFile or faVolumeID or faDirectory }
|
||||||
{ FindFirstFile is a Win32 Call }
|
{ FindFirstFile is a Win32 Call }
|
||||||
Rslt.FindHandle:=Windows.FindFirstFileW( PWideChar(UTF8Decode(Path)),find{%H-});
|
{$IFDEF ACP_RTL}
|
||||||
|
Rslt.FindHandle:=Windows.FindFirstFileW(PWideChar(WideString(Path)),find{%H-});
|
||||||
|
{$ELSE}
|
||||||
|
Rslt.FindHandle:=Windows.FindFirstFileW(PWideChar(UTF8Decode(Path)),find{%H-});
|
||||||
|
{$ENDIF}
|
||||||
If Rslt.FindHandle=Windows.Invalid_Handle_value then
|
If Rslt.FindHandle=Windows.Invalid_Handle_value then
|
||||||
begin
|
begin
|
||||||
Result:=GetLastError;
|
Result:=GetLastError;
|
||||||
|
Loading…
Reference in New Issue
Block a user