mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-20 13:09:15 +02:00
System.ioutils changes some nested $if $else $if to $if $elseif
This commit is contained in:
parent
f3f9c68ddb
commit
a57e34403c
@ -38,23 +38,22 @@ type
|
|||||||
fmTruncate, fmAppend);
|
fmTruncate, fmAppend);
|
||||||
TFileAccess = (faRead, faWrite, faReadWrite);
|
TFileAccess = (faRead, faWrite, faReadWrite);
|
||||||
TFileShare = (fsNone, fsRead, fsWrite, fsReadWrite);
|
TFileShare = (fsNone, fsRead, fsWrite, fsReadWrite);
|
||||||
{$IFDEF WINDOWS}
|
{$IF DEFINED(WINDOWS)}
|
||||||
TFileAttribute = (faReadOnly, faHidden, faSystem, faDirectory, faArchive,
|
TFileAttribute = (faReadOnly, faHidden, faSystem, faDirectory, faArchive,
|
||||||
faDevice, faNormal, faTemporary, faSparseFile,
|
faDevice, faNormal, faTemporary, faSparseFile,
|
||||||
faReparsePoint, faCompressed, faOffline,
|
faReparsePoint, faCompressed, faOffline,
|
||||||
faNotContentIndexed, faEncrypted, faSymLink) ;
|
faNotContentIndexed, faEncrypted, faSymLink) ;
|
||||||
|
{$ELSEIF DEFINED(UNIX)}
|
||||||
|
TFileAttribute = (faNamedPipe, faCharacterDevice, faDirectory, faBlockDevice,
|
||||||
|
faNormal, faSymLink, faSocket, faWhiteout,
|
||||||
|
faOwnerRead, faOwnerWrite, faOwnerExecute,
|
||||||
|
faGroupRead, faGroupWrite, faGroupExecute,
|
||||||
|
faOthersRead, faOthersWrite, faOthersExecute,
|
||||||
|
faUserIDExecution, faGroupIDExecution, faStickyBit);
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
{$IFDEF UNIX}
|
TFileAttribute = (faReadOnly, faHidden, faSystem, faDirectory, faArchive,
|
||||||
TFileAttribute = (faNamedPipe, faCharacterDevice, faDirectory, faBlockDevice,
|
faNormal, faSymLink);
|
||||||
faNormal, faSymLink, faSocket, faWhiteout,
|
|
||||||
faOwnerRead, faOwnerWrite, faOwnerExecute,
|
|
||||||
faGroupRead, faGroupWrite, faGroupExecute,
|
|
||||||
faOthersRead, faOthersWrite, faOthersExecute,
|
|
||||||
faUserIDExecution, faGroupIDExecution, faStickyBit);
|
|
||||||
{$ELSE}
|
|
||||||
TFileAttribute = (faReadOnly, faHidden, faSystem, faDirectory, faArchive,
|
|
||||||
faNormal, faSymLink);
|
|
||||||
{$ENDIF}
|
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
TFileAttributes = set of TFileAttribute;
|
TFileAttributes = set of TFileAttribute;
|
||||||
@ -934,7 +933,7 @@ begin
|
|||||||
Result:=IntGetPathRoot(aPath);
|
Result:=IntGetPathRoot(aPath);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$IFDEF Unix}
|
{$IF DEFINED(Unix)}
|
||||||
class function TPath.IntGetPathRoot(const aPath: string): string;
|
class function TPath.IntGetPathRoot(const aPath: string): string;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
@ -943,9 +942,7 @@ begin
|
|||||||
else
|
else
|
||||||
Result:='';
|
Result:='';
|
||||||
end;
|
end;
|
||||||
{$ENDIF POSIX}
|
{$ELSEIF DEFINED(WINDOWS)}
|
||||||
|
|
||||||
{$IFDEF WINDOWS}
|
|
||||||
class function TPath.IntGetPathRoot(const aPath: string): string;
|
class function TPath.IntGetPathRoot(const aPath: string): string;
|
||||||
|
|
||||||
var
|
var
|
||||||
@ -990,9 +987,7 @@ begin
|
|||||||
if NeedSeparator then
|
if NeedSeparator then
|
||||||
Result:=Result+PathDelim;
|
Result:=Result+PathDelim;
|
||||||
end;
|
end;
|
||||||
{$ENDIF MSWINDOWS}
|
{$ELSEIF DEFINED(HASAMIGA)}
|
||||||
|
|
||||||
{$IFDEF HASAMIGA}
|
|
||||||
class function TPath.IntGetPathRoot(const aPath: string): string;
|
class function TPath.IntGetPathRoot(const aPath: string): string;
|
||||||
begin
|
begin
|
||||||
if Pos(DriveSeparator, aPath) > 0 then
|
if Pos(DriveSeparator, aPath) > 0 then
|
||||||
@ -1000,9 +995,7 @@ begin
|
|||||||
else
|
else
|
||||||
Result := '';
|
Result := '';
|
||||||
end;
|
end;
|
||||||
{$ENDIF}
|
{$ELSE}
|
||||||
|
|
||||||
{$IF NOT DEFINED(WINDOWS) AND NOT DEFINED(UNIX) AND NOT DEFINED(HASAMIGA)}
|
|
||||||
class function TPath.IntGetPathRoot(const aPath: string): string;
|
class function TPath.IntGetPathRoot(const aPath: string): string;
|
||||||
begin
|
begin
|
||||||
Result:='';
|
Result:='';
|
||||||
@ -1403,8 +1396,7 @@ class procedure TFile.GetFileTimestamps(const aFilename: TFileName;
|
|||||||
Info: stat;
|
Info: stat;
|
||||||
{$EndIf}
|
{$EndIf}
|
||||||
begin
|
begin
|
||||||
|
{$If Defined(MSWINDOWS)}
|
||||||
{$IfDef MSWINDOWS}
|
|
||||||
if not GetFileAttributesEx(PChar(aFileName), GetFileExInfoStandard, @info) then
|
if not GetFileAttributesEx(PChar(aFileName), GetFileExInfoStandard, @info) then
|
||||||
RaiseLastOSError;
|
RaiseLastOSError;
|
||||||
DosTime:=0;
|
DosTime:=0;
|
||||||
@ -1414,15 +1406,14 @@ begin
|
|||||||
WriteUTC :=FileDateToDateTime(DosTime);
|
WriteUTC :=FileDateToDateTime(DosTime);
|
||||||
FileTimeToDosDateTime(info.ftLastAccessTime, LongRec(DosTime).Hi, LongRec(DosTime).Lo);
|
FileTimeToDosDateTime(info.ftLastAccessTime, LongRec(DosTime).Hi, LongRec(DosTime).Lo);
|
||||||
AccessUTC:=FileDateToDateTime(DosTime);
|
AccessUTC:=FileDateToDateTime(DosTime);
|
||||||
|
{$ElseIf Defined(UNIX)}
|
||||||
|
Info:=Default(Stat);
|
||||||
|
if fpstat(aFileName, info) <> 0 then
|
||||||
|
raise EInOutError.CreateFmt(errStatFailed, [aFileName, fpgeterrno]);
|
||||||
|
CreateUTC:=UnixToDateTime(info.st_ctime, True);
|
||||||
|
WriteUTC :=UnixToDateTime(info.st_mtime, True);
|
||||||
|
AccessUTC:=UnixToDateTime(info.st_atime, True);
|
||||||
{$Else}
|
{$Else}
|
||||||
{$ifdef UNIX}
|
|
||||||
Info:=Default(Stat);
|
|
||||||
if fpstat(aFileName, info) <> 0 then
|
|
||||||
raise EInOutError.CreateFmt(errStatFailed, [aFileName, fpgeterrno]);
|
|
||||||
CreateUTC:=UnixToDateTime(info.st_ctime, True);
|
|
||||||
WriteUTC :=UnixToDateTime(info.st_mtime, True);
|
|
||||||
AccessUTC:=UnixToDateTime(info.st_atime, True);
|
|
||||||
{$else}
|
|
||||||
if FileAge(aFilename, CreateUTC) then
|
if FileAge(aFilename, CreateUTC) then
|
||||||
begin
|
begin
|
||||||
WriteUTC := CreateUTC;
|
WriteUTC := CreateUTC;
|
||||||
@ -1430,7 +1421,6 @@ begin
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
raise EInOutError.CreateFmt(SErrFileNotFound, [aFileName]);
|
raise EInOutError.CreateFmt(SErrFileNotFound, [aFileName]);
|
||||||
{$endif}
|
|
||||||
{$EndIf}
|
{$EndIf}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1442,25 +1432,23 @@ class function TFile.IntegerToFileAttributes(const Attributes: Integer
|
|||||||
FileAttribs:=FileAttribs + [FileAttrib];
|
FileAttribs:=FileAttribs + [FileAttrib];
|
||||||
end;
|
end;
|
||||||
begin
|
begin
|
||||||
{$IFDEF UNIX}
|
{$If Defined(UNIX)}
|
||||||
// Assume full mode
|
// Assume full mode
|
||||||
Result:=ModeToFileAttributes(Attributes);
|
Result:=ModeToFileAttributes(Attributes);
|
||||||
{$ELSE}
|
{$ElseIf Defined(WINDOWS)}
|
||||||
{$IFDEF WINDOWS}
|
// Assume all flags
|
||||||
// Assume all flags
|
Result:=FlagsToFileAttributes(Attributes);
|
||||||
Result:=FlagsToFileAttributes(Attributes);
|
{$Else}
|
||||||
{$ELSE}
|
{ Attributes supported by TSearchRec}
|
||||||
{ Attributes supported by TSearchRec}
|
Result:=[];
|
||||||
Result:=[];
|
AddIfSet(Result, SysUtils.faDirectory, TFileAttribute.faDirectory);
|
||||||
AddIfSet(Result, SysUtils.faDirectory, TFileAttribute.faDirectory);
|
AddIfSet(Result, SysUtils.faSymLink{%H-}, TFileAttribute.faSymLink);
|
||||||
AddIfSet(Result, SysUtils.faSymLink{%H-}, TFileAttribute.faSymLink);
|
AddIfSet(Result, SysUtils.faNormal, TFileAttribute.faNormal);
|
||||||
AddIfSet(Result, SysUtils.faNormal, TFileAttribute.faNormal);
|
AddIfSet(Result, SysUtils.faDirectory, TFileAttribute.faDirectory);
|
||||||
AddIfSet(Result, SysUtils.faDirectory, TFileAttribute.faDirectory);
|
AddIfSet(Result, SysUtils.faSymLink{%H-}, TFileAttribute.faSymLink);
|
||||||
AddIfSet(Result, SysUtils.faSymLink{%H-}, TFileAttribute.faSymLink);
|
AddIfSet(Result, SysUtils.faHidden{%H-}, TFileAttribute.faHidden);
|
||||||
AddIfSet(Result, SysUtils.faHidden{%H-}, TFileAttribute.faHidden);
|
AddIfSet(Result, SysUtils.faSysFile{%H-}, TFileAttribute.faSystem);
|
||||||
AddIfSet(Result, SysUtils.faSysFile{%H-}, TFileAttribute.faSystem);
|
AddIfSet(Result, SysUtils.faArchive, TFileAttribute.faArchive);
|
||||||
AddIfSet(Result, SysUtils.faArchive, TFileAttribute.faArchive);
|
|
||||||
{$EndIf}
|
|
||||||
{$EndIf}
|
{$EndIf}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user