mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-10 14:18:17 +02:00
replaced {$IFDEF windows} by {$IFDEF mswindows}, because fpc 2.0.2 doesn't define windows
git-svn-id: trunk@8748 -
This commit is contained in:
parent
5afec4ebb6
commit
6baf007027
@ -99,7 +99,7 @@ function GetTempFilename(const Path, Prefix: string): string;
|
|||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
{$IFNDEF windows}
|
{$IFNDEF mswindows}
|
||||||
uses
|
uses
|
||||||
Unix, BaseUnix;
|
Unix, BaseUnix;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
@ -39,7 +39,7 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function CompareFilenames(const Filename1, Filename2: string): integer;
|
function CompareFilenames(const Filename1, Filename2: string): integer;
|
||||||
begin
|
begin
|
||||||
{$IFDEF WINDOWS}
|
{$IFDEF MSWINDOWS}
|
||||||
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 WINDOWS}
|
{$IFDEF MSWINDOWS}
|
||||||
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 WINDOWS}
|
{$IFDEF MSWINDOWS}
|
||||||
// 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 WINDOWS}
|
{$IFDEF MSWINDOWS}
|
||||||
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 WINDOWS}
|
{$IFDEF MSWINDOWS}
|
||||||
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
|
||||||
@ -447,7 +447,7 @@ end;
|
|||||||
procedure CheckIfFileIsSymlink(const AFilename: string);
|
procedure CheckIfFileIsSymlink(const AFilename: string);
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
procedure CheckIfFileIsSymlink(const AFilename: string);
|
procedure CheckIfFileIsSymlink(const AFilename: string);
|
||||||
{$IFNDEF WINDOWS}
|
{$IFNDEF MSWINDOWS}
|
||||||
var
|
var
|
||||||
AText: string;
|
AText: string;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
@ -456,7 +456,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 WINDOWS}
|
{$IFDEF MSWINDOWS}
|
||||||
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
|
||||||
@ -486,7 +486,7 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function FileIsSymlink(const AFilename: string): boolean;
|
function FileIsSymlink(const AFilename: string): boolean;
|
||||||
begin
|
begin
|
||||||
{$IFDEF WINDOWS}
|
{$IFDEF MSWINDOWS}
|
||||||
Result:=false;
|
Result:=false;
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
Result:=(FpReadLink(AFilename)<>'');
|
Result:=(FpReadLink(AFilename)<>'');
|
||||||
@ -498,7 +498,7 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function FileIsReadable(const AFilename: string): boolean;
|
function FileIsReadable(const AFilename: string): boolean;
|
||||||
begin
|
begin
|
||||||
{$IFDEF WINDOWS}
|
{$IFDEF MSWINDOWS}
|
||||||
Result:=true;
|
Result:=true;
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
Result:= BaseUnix.FpAccess(AFilename,BaseUnix.R_OK)=0;
|
Result:= BaseUnix.FpAccess(AFilename,BaseUnix.R_OK)=0;
|
||||||
@ -510,7 +510,7 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function FileIsWritable(const AFilename: string): boolean;
|
function FileIsWritable(const AFilename: string): boolean;
|
||||||
begin
|
begin
|
||||||
{$IFDEF WINDOWS}
|
{$IFDEF MSWINDOWS}
|
||||||
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;
|
||||||
@ -521,7 +521,7 @@ end;
|
|||||||
GetFileDescription
|
GetFileDescription
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function GetFileDescription(const AFilename: string): string;
|
function GetFileDescription(const AFilename: string): string;
|
||||||
{$IFDEF WINDOWS}
|
{$IFDEF MSWINDOWS}
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
var
|
var
|
||||||
info: Stat;
|
info: Stat;
|
||||||
@ -535,7 +535,7 @@ var
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
begin
|
begin
|
||||||
Result:='';
|
Result:='';
|
||||||
{$IFDEF WINDOWS}
|
{$IFDEF MSWINDOWS}
|
||||||
|
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
if not (FpStat(AFilename,info)=0) then exit;
|
if not (FpStat(AFilename,info)=0) then exit;
|
||||||
@ -620,14 +620,14 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function ReadAllLinks(const Filename: string;
|
function ReadAllLinks(const Filename: string;
|
||||||
ExceptionOnError: boolean): string;
|
ExceptionOnError: boolean): string;
|
||||||
{$IFNDEF WINDOWS}
|
{$IFNDEF MSWINDOWS}
|
||||||
var
|
var
|
||||||
LinkFilename: string;
|
LinkFilename: string;
|
||||||
AText: string;
|
AText: string;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
begin
|
begin
|
||||||
Result:=Filename;
|
Result:=Filename;
|
||||||
{$IFDEF WINDOWS}
|
{$IFDEF MSWINDOWS}
|
||||||
|
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
repeat
|
repeat
|
||||||
@ -681,7 +681,7 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function FileIsExecutable(const AFilename: string): boolean;
|
function FileIsExecutable(const AFilename: string): boolean;
|
||||||
begin
|
begin
|
||||||
{$IFDEF WINDOWS}
|
{$IFDEF MSWINDOWS}
|
||||||
Result:=FileExists(AFilename);
|
Result:=FileExists(AFilename);
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
Result:= BaseUnix.FpAccess(AFilename,BaseUnix.X_OK)=0;
|
Result:= BaseUnix.FpAccess(AFilename,BaseUnix.X_OK)=0;
|
||||||
@ -692,7 +692,7 @@ end;
|
|||||||
procedure CheckIfFileIsExecutable(const AFilename: string);
|
procedure CheckIfFileIsExecutable(const AFilename: string);
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
procedure CheckIfFileIsExecutable(const AFilename: string);
|
procedure CheckIfFileIsExecutable(const AFilename: string);
|
||||||
{$IFNDEF WINDOWS}
|
{$IFNDEF MSWINDOWS}
|
||||||
var AText: string;
|
var AText: string;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
begin
|
begin
|
||||||
@ -704,7 +704,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 WINDOWS}
|
{$IFNDEF MSWINDOWS}
|
||||||
if not FileIsExecutable(AFilename) then
|
if not FileIsExecutable(AFilename) then
|
||||||
begin
|
begin
|
||||||
AText:='"'+AFilename+'"';
|
AText:='"'+AFilename+'"';
|
||||||
@ -792,7 +792,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 windows}
|
{$IFDEF MSWINDOWS}
|
||||||
Flags:=[];
|
Flags:=[];
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
Flags:=[sffDontSearchInBasePath];
|
Flags:=[sffDontSearchInBasePath];
|
||||||
@ -946,7 +946,7 @@ begin
|
|||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
if FilePos>FileLen then break;
|
if FilePos>FileLen then break;
|
||||||
{$IFDEF WINDOWS}
|
{$IFDEF MSWINDOWS}
|
||||||
if UpperCaseTable[byte(MaskChar)]
|
if UpperCaseTable[byte(MaskChar)]
|
||||||
=UpperCaseTable[byte(TrimmedFile[FilePos])] then
|
=UpperCaseTable[byte(TrimmedFile[FilePos])] then
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
@ -1158,7 +1158,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 WINDOWS}
|
{$IFDEF MSWINDOWS}
|
||||||
// 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
|
||||||
@ -1219,7 +1219,7 @@ end;
|
|||||||
|
|
||||||
function GetAllFilesMask: string;
|
function GetAllFilesMask: string;
|
||||||
begin
|
begin
|
||||||
{$IFDEF WINDOWS}
|
{$IFDEF MSWINDOWS}
|
||||||
Result:='*.*';
|
Result:='*.*';
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
Result:='*';
|
Result:='*';
|
||||||
|
Loading…
Reference in New Issue
Block a user