replaced {$IFDEF mswindows} by {$IFDEF windows}

git-svn-id: trunk@8863 -
This commit is contained in:
vincents 2006-03-03 20:58:21 +00:00
parent 5bb39b97a3
commit 841106f0ca
2 changed files with 22 additions and 22 deletions

View File

@ -108,7 +108,7 @@ function GetTempFilename(const Path, Prefix: string): string;
implementation implementation
{$IFNDEF mswindows} {$IFNDEF windows}
uses uses
Unix, BaseUnix; Unix, BaseUnix;
{$ENDIF} {$ENDIF}

View File

@ -39,7 +39,7 @@ end;
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
function CompareFilenames(const Filename1, Filename2: string): integer; function CompareFilenames(const Filename1, Filename2: string): integer;
begin begin
{$IFDEF MSWINDOWS} {$IFDEF WINDOWS}
Result:=AnsiCompareText(Filename1, Filename2); Result:=AnsiCompareText(Filename1, Filename2);
{$ELSE} {$ELSE}
Result:=AnsiCompareStr(Filename1, Filename2); Result:=AnsiCompareStr(Filename1, Filename2);
@ -88,7 +88,7 @@ begin
Result:=0; Result:=0;
i:=1; i:=1;
while (Result=0) and ((i<=Len1) and (i<=Len2)) do begin while (Result=0) and ((i<=Len1) and (i<=Len2)) do begin
{$IFDEF MSWINDOWS} {$IFDEF WINDOWS}
Result:=Ord(LowerCaseTable[Ord(Filename1[i])]) Result:=Ord(LowerCaseTable[Ord(Filename1[i])])
-Ord(LowerCaseTable[Ord(Filename2[i])]); //!! Must be replaced by ansi characters !! -Ord(LowerCaseTable[Ord(Filename2[i])]); //!! Must be replaced by ansi characters !!
{$ELSE} {$ELSE}
@ -107,7 +107,7 @@ end;
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
function FilenameIsAbsolute(const TheFilename: string):boolean; function FilenameIsAbsolute(const TheFilename: string):boolean;
begin begin
{$IFDEF MSWINDOWS} {$IFDEF WINDOWS}
// windows // windows
Result:=FilenameIsWinAbsolute(TheFilename); Result:=FilenameIsWinAbsolute(TheFilename);
{$ELSE} {$ELSE}
@ -219,7 +219,7 @@ begin
// check for double path delims // check for double path delims
if (c=PathDelim) then begin if (c=PathDelim) then begin
inc(SrcPos); inc(SrcPos);
{$IFDEF MSWINDOWS} {$IFDEF WINDOWS}
if (DestPos>2) if (DestPos>2)
{$ELSE} {$ELSE}
if (DestPos>1) if (DestPos>1)
@ -258,7 +258,7 @@ begin
// 2. /.. -> skip .., keep / // 2. /.. -> skip .., keep /
inc(SrcPos,2); inc(SrcPos,2);
continue; continue;
{$IFDEF MSWINDOWS} {$IFDEF WINDOWS}
end else if (DestPos=3) and (Result[2]=':') end else if (DestPos=3) and (Result[2]=':')
and (Result[1] in ['a'..'z','A'..'Z']) then begin and (Result[1] in ['a'..'z','A'..'Z']) then begin
// 3. C:.. -> copy // 3. C:.. -> copy
@ -462,7 +462,7 @@ end;
procedure CheckIfFileIsSymlink(const AFilename: string); procedure CheckIfFileIsSymlink(const AFilename: string);
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
procedure CheckIfFileIsSymlink(const AFilename: string); procedure CheckIfFileIsSymlink(const AFilename: string);
{$IFNDEF MSWINDOWS} {$IFNDEF WINDOWS}
var var
AText: string; AText: string;
{$ENDIF} {$ENDIF}
@ -471,7 +471,7 @@ begin
if not FileExists(AFilename) then begin if not FileExists(AFilename) then begin
raise Exception.Create('file "'+AFilename+'" does not exist'); raise Exception.Create('file "'+AFilename+'" does not exist');
end; end;
{$IFDEF MSWINDOWS} {$IFDEF WINDOWS}
raise Exception.Create('"'+AFilename+'" is not symlink'); raise Exception.Create('"'+AFilename+'" is not symlink');
{$ELSE} {$ELSE}
if FpReadLink(AFilename)='' then begin if FpReadLink(AFilename)='' then begin
@ -501,7 +501,7 @@ end;
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
function FileIsSymlink(const AFilename: string): boolean; function FileIsSymlink(const AFilename: string): boolean;
begin begin
{$IFDEF MSWINDOWS} {$IFDEF WINDOWS}
Result:=false; Result:=false;
{$ELSE} {$ELSE}
Result:=(FpReadLink(AFilename)<>''); Result:=(FpReadLink(AFilename)<>'');
@ -513,7 +513,7 @@ end;
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
function FileIsReadable(const AFilename: string): boolean; function FileIsReadable(const AFilename: string): boolean;
begin begin
{$IFDEF MSWINDOWS} {$IFDEF WINDOWS}
Result:=true; Result:=true;
{$ELSE} {$ELSE}
Result:= BaseUnix.FpAccess(AFilename,BaseUnix.R_OK)=0; Result:= BaseUnix.FpAccess(AFilename,BaseUnix.R_OK)=0;
@ -525,7 +525,7 @@ end;
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
function FileIsWritable(const AFilename: string): boolean; function FileIsWritable(const AFilename: string): boolean;
begin begin
{$IFDEF MSWINDOWS} {$IFDEF WINDOWS}
Result:=((FileGetAttr(AFilename) and faReadOnly)=0); Result:=((FileGetAttr(AFilename) and faReadOnly)=0);
{$ELSE} {$ELSE}
Result:= BaseUnix.FpAccess(AFilename,BaseUnix.W_OK)=0; Result:= BaseUnix.FpAccess(AFilename,BaseUnix.W_OK)=0;
@ -547,7 +547,7 @@ end;
GetFileDescription GetFileDescription
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
function GetFileDescription(const AFilename: string): string; function GetFileDescription(const AFilename: string): string;
{$IFDEF MSWINDOWS} {$IFDEF WINDOWS}
{$ELSE} {$ELSE}
var var
info: Stat; info: Stat;
@ -561,7 +561,7 @@ var
{$ENDIF} {$ENDIF}
begin begin
Result:=''; Result:='';
{$IFDEF MSWINDOWS} {$IFDEF WINDOWS}
{$ELSE} {$ELSE}
if not (FpStat(AFilename,info)=0) then exit; if not (FpStat(AFilename,info)=0) then exit;
@ -646,14 +646,14 @@ end;
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
function ReadAllLinks(const Filename: string; function ReadAllLinks(const Filename: string;
ExceptionOnError: boolean): string; ExceptionOnError: boolean): string;
{$IFNDEF MSWINDOWS} {$IFNDEF WINDOWS}
var var
LinkFilename: string; LinkFilename: string;
AText: string; AText: string;
{$ENDIF} {$ENDIF}
begin begin
Result:=Filename; Result:=Filename;
{$IFDEF MSWINDOWS} {$IFDEF WINDOWS}
{$ELSE} {$ELSE}
repeat repeat
@ -707,7 +707,7 @@ end;
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
function FileIsExecutable(const AFilename: string): boolean; function FileIsExecutable(const AFilename: string): boolean;
begin begin
{$IFDEF MSWINDOWS} {$IFDEF WINDOWS}
Result:=FileExists(AFilename); Result:=FileExists(AFilename);
{$ELSE} {$ELSE}
Result:= BaseUnix.FpAccess(AFilename,BaseUnix.X_OK)=0; Result:= BaseUnix.FpAccess(AFilename,BaseUnix.X_OK)=0;
@ -718,7 +718,7 @@ end;
procedure CheckIfFileIsExecutable(const AFilename: string); procedure CheckIfFileIsExecutable(const AFilename: string);
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
procedure CheckIfFileIsExecutable(const AFilename: string); procedure CheckIfFileIsExecutable(const AFilename: string);
{$IFNDEF MSWINDOWS} {$IFNDEF WINDOWS}
var AText: string; var AText: string;
{$ENDIF} {$ENDIF}
begin begin
@ -730,7 +730,7 @@ begin
if DirPathExists(AFilename) then begin if DirPathExists(AFilename) then begin
raise Exception.Create('file "'+AFilename+'" is a directory and not an executable'); raise Exception.Create('file "'+AFilename+'" is a directory and not an executable');
end; end;
{$IFNDEF MSWINDOWS} {$IFNDEF WINDOWS}
if not FileIsExecutable(AFilename) then if not FileIsExecutable(AFilename) then
begin begin
AText:='"'+AFilename+'"'; AText:='"'+AFilename+'"';
@ -818,7 +818,7 @@ begin
Result:=ParamStr(0); Result:=ParamStr(0);
if ExtractFilePath(Result)='' then begin if ExtractFilePath(Result)='' then begin
// program was started via PATH // program was started via PATH
{$IFDEF MSWINDOWS} {$IFDEF WINDOWS}
Flags:=[]; Flags:=[];
{$ELSE} {$ELSE}
Flags:=[sffDontSearchInBasePath]; Flags:=[sffDontSearchInBasePath];
@ -972,7 +972,7 @@ begin
else else
begin begin
if FilePos>FileLen then break; if FilePos>FileLen then break;
{$IFDEF MSWINDOWS} {$IFDEF WINDOWS}
if UpperCaseTable[byte(MaskChar)] if UpperCaseTable[byte(MaskChar)]
=UpperCaseTable[byte(TrimmedFile[FilePos])] then =UpperCaseTable[byte(TrimmedFile[FilePos])] then
{$ELSE} {$ELSE}
@ -1184,7 +1184,7 @@ begin
if not FileExists(Filename) then exit; if not FileExists(Filename) then exit;
// check every directory and filename // check every directory and filename
StartPos:=1; StartPos:=1;
{$IFDEF MSWINDOWS} {$IFDEF WINDOWS}
// uppercase Drive letter and skip it // uppercase Drive letter and skip it
if ((length(Result)>=2) and (Result[1] in ['A'..'Z','a'..'z']) if ((length(Result)>=2) and (Result[1] in ['A'..'Z','a'..'z'])
and (Result[2]=':')) then begin and (Result[2]=':')) then begin
@ -1276,7 +1276,7 @@ end;
function GetAllFilesMask: string; function GetAllFilesMask: string;
begin begin
{$IFDEF MSWINDOWS} {$IFDEF WINDOWS}
Result:='*.*'; Result:='*.*';
{$ELSE} {$ELSE}
Result:='*'; Result:='*';