mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-21 10:19:38 +02:00
LazUtils: TFileStreamUTF8 = TFileStream: FPC 3.x has full UTF8 support and better exceptions (SFOpenError/SFOpenErrorEx). FileName was redeclared in TFileStreamUTF8
git-svn-id: trunk@62638 -
This commit is contained in:
parent
8894c3707a
commit
2c8411425b
@ -19,14 +19,7 @@ type
|
||||
|
||||
{ TFileStreamUTF8 }
|
||||
|
||||
TFileStreamUTF8 = class(TFileStream)
|
||||
private
|
||||
FFileName: string;
|
||||
public
|
||||
constructor Create(const AFileName: string; Mode: Word);
|
||||
constructor Create(const AFileName: string; Mode: Word; Rights: Cardinal);
|
||||
property FileName: string Read FFilename;
|
||||
end;
|
||||
TFileStreamUTF8 = TFileStream;
|
||||
|
||||
{ TStringListUTF8 }
|
||||
|
||||
@ -124,38 +117,6 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
constructor TFileStreamUTF8.Create(const AFileName: string; Mode: Word);
|
||||
begin
|
||||
Create(AFileName,Mode,438);
|
||||
{ Rights 438 is the default in the FCL TFileStream
|
||||
Under Unix:
|
||||
438 = &666 = owner/group/others can read/write
|
||||
Note: the real rights are "Rights and not umask"
|
||||
Under Windows Rights is not used.
|
||||
}
|
||||
end;
|
||||
|
||||
constructor TFileStreamUTF8.Create(const AFileName: string; Mode: Word; Rights: Cardinal);
|
||||
var
|
||||
lHandle: THandle;
|
||||
begin
|
||||
FFileName:=AFileName;
|
||||
if (Mode and fmCreate) > 0 then
|
||||
lHandle:=FileCreateUTF8(AFileName,Mode,Rights)
|
||||
else
|
||||
lHandle:=FileOpenUTF8(AFileName,Mode);
|
||||
|
||||
if (THandle(lHandle)=feInvalidHandle) then
|
||||
begin
|
||||
if Mode=fmcreate then
|
||||
raise EFCreateError.createfmt({SFCreateError}'Unable to create file "%s"',[AFileName])
|
||||
else
|
||||
raise EFOpenError.Createfmt({SFOpenError}'Unable to open file "%s"',[AFilename]);
|
||||
end
|
||||
else
|
||||
THandleStream(Self).Create(lHandle);
|
||||
end;
|
||||
|
||||
function TStringListUTF8.DoCompareText(const s1, s2: string): PtrInt;
|
||||
begin
|
||||
if CaseSensitive then
|
||||
|
Loading…
Reference in New Issue
Block a user