mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-08 20:35:58 +02:00
codetools: use Windows instead of MSWindows define in case someone want to build codetools for wince
git-svn-id: trunk@29121 -
This commit is contained in:
parent
3ed56f1dae
commit
08d510cd25
@ -27,7 +27,14 @@
|
|||||||
}
|
}
|
||||||
unit BasicCodeTools;
|
unit BasicCodeTools;
|
||||||
|
|
||||||
{$ifdef FPC}{$mode objfpc}{$endif}{$H+}
|
{$ifdef FPC}
|
||||||
|
{$mode objfpc}
|
||||||
|
{$else}
|
||||||
|
// delphi? if so then Windows is not defined but instead MSWindows is defined => define Windows in this case
|
||||||
|
{$ifdef MSWindows}
|
||||||
|
{$define Windows}
|
||||||
|
{$endif}
|
||||||
|
{$endif}{$H+}
|
||||||
{$inline on}
|
{$inline on}
|
||||||
|
|
||||||
interface
|
interface
|
||||||
@ -4757,7 +4764,7 @@ var
|
|||||||
p: Integer;
|
p: Integer;
|
||||||
begin
|
begin
|
||||||
CompareCaseInsensitive:=CaseInsensitive;
|
CompareCaseInsensitive:=CaseInsensitive;
|
||||||
{$IFDEF MSWindows}
|
{$IFDEF Windows}
|
||||||
CompareCaseInsensitive:=true;
|
CompareCaseInsensitive:=true;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ uses
|
|||||||
{ $DEFINE ShowTriedFiles}
|
{ $DEFINE ShowTriedFiles}
|
||||||
{ $DEFINE ShowTriedUnits}
|
{ $DEFINE ShowTriedUnits}
|
||||||
|
|
||||||
{$ifdef MSWindows}
|
{$ifdef Windows}
|
||||||
{$define CaseInsensitiveFilenames}
|
{$define CaseInsensitiveFilenames}
|
||||||
{$endif}
|
{$endif}
|
||||||
{$IF defined(CaseInsensitiveFilenames) or defined(darwin)}
|
{$IF defined(CaseInsensitiveFilenames) or defined(darwin)}
|
||||||
|
@ -25,7 +25,14 @@
|
|||||||
}
|
}
|
||||||
unit FileProcs;
|
unit FileProcs;
|
||||||
|
|
||||||
{$ifdef FPC}{$mode objfpc}{$endif}{$H+}
|
{$ifdef FPC}
|
||||||
|
{$mode objfpc}
|
||||||
|
{$else}
|
||||||
|
// delphi? if so then Windows is not defined but instead MSWindows is defined => define Windows in this case
|
||||||
|
{$ifdef MSWindows}
|
||||||
|
{$define Windows}
|
||||||
|
{$endif}
|
||||||
|
{$endif}{$H+}
|
||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
@ -54,7 +61,7 @@ const
|
|||||||
FilenamesLiteral = {$IFDEF NotLiteralFilenames}false{$ELSE}true{$ENDIF};// file names can be compared using = string operator
|
FilenamesLiteral = {$IFDEF NotLiteralFilenames}false{$ELSE}true{$ENDIF};// file names can be compared using = string operator
|
||||||
|
|
||||||
SpecialChar = '#'; // used to use PathDelim, e.g. #\
|
SpecialChar = '#'; // used to use PathDelim, e.g. #\
|
||||||
{$IFDEF MSWindows}
|
{$IFDEF Windows}
|
||||||
FileMask = '*.*';
|
FileMask = '*.*';
|
||||||
ExeExt = '.exe';
|
ExeExt = '.exe';
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
@ -417,7 +424,7 @@ implementation
|
|||||||
|
|
||||||
// to get more detailed error messages consider the os
|
// to get more detailed error messages consider the os
|
||||||
uses
|
uses
|
||||||
{$IFDEF MSWindows}
|
{$IFDEF Windows}
|
||||||
Windows;
|
Windows;
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
{$IFDEF darwin}
|
{$IFDEF darwin}
|
||||||
@ -715,7 +722,7 @@ begin
|
|||||||
Result:=Filename;
|
Result:=Filename;
|
||||||
// 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
|
||||||
@ -966,7 +973,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure CheckIfFileIsExecutable(const AFilename: string);
|
procedure CheckIfFileIsExecutable(const AFilename: string);
|
||||||
{$IFNDEF MSWindows}
|
{$IFNDEF Windows}
|
||||||
var AText: string;
|
var AText: string;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
begin
|
begin
|
||||||
@ -975,7 +982,7 @@ begin
|
|||||||
if not FileExistsUTF8(AFilename) then begin
|
if not FileExistsUTF8(AFilename) then begin
|
||||||
raise Exception.CreateFmt(ctsFileDoesNotExists,[AFilename]);
|
raise Exception.CreateFmt(ctsFileDoesNotExists,[AFilename]);
|
||||||
end;
|
end;
|
||||||
{$IFNDEF MSWindows}
|
{$IFNDEF Windows}
|
||||||
if not(BaseUnix.FpAccess(AFilename,BaseUnix.X_OK)=0) then
|
if not(BaseUnix.FpAccess(AFilename,BaseUnix.X_OK)=0) then
|
||||||
begin
|
begin
|
||||||
AText:='"'+AFilename+'"';
|
AText:='"'+AFilename+'"';
|
||||||
@ -1012,7 +1019,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}
|
||||||
@ -1094,7 +1101,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;
|
||||||
@ -1103,7 +1110,7 @@ end;
|
|||||||
|
|
||||||
function FileIsWritable(const AFilename: string): boolean;
|
function FileIsWritable(const AFilename: string): boolean;
|
||||||
begin
|
begin
|
||||||
{$IFDEF MSWindows}
|
{$IFDEF Windows}
|
||||||
Result:=((FileGetAttrUTF8(AFilename) and faReadOnly)=0);
|
Result:=((FileGetAttrUTF8(AFilename) and faReadOnly)=0);
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
Result:= BaseUnix.FpAccess(AFilename,BaseUnix.W_OK)=0;
|
Result:= BaseUnix.FpAccess(AFilename,BaseUnix.W_OK)=0;
|
||||||
@ -1255,7 +1262,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)
|
||||||
@ -1295,7 +1302,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
|
||||||
@ -1412,7 +1419,7 @@ begin
|
|||||||
Result:=Filename;
|
Result:=Filename;
|
||||||
if (BaseDirectory='') or (Filename='') then exit;
|
if (BaseDirectory='') or (Filename='') then exit;
|
||||||
|
|
||||||
{$IFDEF MSWindows}
|
{$IFDEF Windows}
|
||||||
// check for different windows file drives
|
// check for different windows file drives
|
||||||
if (CompareText(ExtractFileDrive(Filename),
|
if (CompareText(ExtractFileDrive(Filename),
|
||||||
ExtractFileDrive(BaseDirectory))<>0)
|
ExtractFileDrive(BaseDirectory))<>0)
|
||||||
|
@ -32,7 +32,14 @@
|
|||||||
}
|
}
|
||||||
unit LinkScanner;
|
unit LinkScanner;
|
||||||
|
|
||||||
{$ifdef FPC} {$mode objfpc} {$endif}{$H+}
|
{$ifdef FPC}
|
||||||
|
{$mode objfpc}
|
||||||
|
{$else}
|
||||||
|
// delphi? if so then Windows is not defined but instead MSWindows is defined => define Windows in this case
|
||||||
|
{$ifdef MSWindows}
|
||||||
|
{$define Windows}
|
||||||
|
{$endif}
|
||||||
|
{$endif}{$H+}
|
||||||
|
|
||||||
{$I codetools.inc}
|
{$I codetools.inc}
|
||||||
|
|
||||||
@ -2985,7 +2992,7 @@ begin
|
|||||||
PathEnd:=PathStart;
|
PathEnd:=PathStart;
|
||||||
while PathEnd<=length(IncludePath) do begin
|
while PathEnd<=length(IncludePath) do begin
|
||||||
if ((Pos(IncludePath[PathEnd],PathDivider))>0)
|
if ((Pos(IncludePath[PathEnd],PathDivider))>0)
|
||||||
{$IFDEF MSWindows}
|
{$IFDEF Windows}
|
||||||
and (not ((PathEnd-PathStart=1) // ignore colon in drive
|
and (not ((PathEnd-PathStart=1) // ignore colon in drive
|
||||||
and (IncludePath[PathEnd]=':')
|
and (IncludePath[PathEnd]=':')
|
||||||
and (IsWordChar[IncludePath[PathEnd-1]])))
|
and (IsWordChar[IncludePath[PathEnd-1]])))
|
||||||
|
Loading…
Reference in New Issue
Block a user