mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-10-16 20:26:29 +02:00
* better auto RTL dir detection
This commit is contained in:
parent
8abfec4e7c
commit
39faeb7440
@ -243,6 +243,7 @@ unit globals;
|
||||
procedure DefaultReplacements(var s:string);
|
||||
|
||||
function path_absolute(const s : string) : boolean;
|
||||
Function PathExists ( F : String) : Boolean;
|
||||
Function FileExists ( Const F : String) : Boolean;
|
||||
Function RemoveFile(const f:string):boolean;
|
||||
Function RemoveDir(d:string):boolean;
|
||||
@ -823,6 +824,17 @@ implementation
|
||||
findclose(Info);
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
Function PathExists ( F : String) : Boolean;
|
||||
Var
|
||||
Info : SearchRec;
|
||||
begin
|
||||
if F[Length(f)] in ['/','\'] then
|
||||
Delete(f,length(f),1);
|
||||
findfirst(F,readonly+archive+hidden+directory,info);
|
||||
PathExists:=(doserror=0) and ((info.attr and directory)=directory);
|
||||
findclose(Info);
|
||||
end;
|
||||
{$endif}
|
||||
|
||||
|
||||
@ -1476,7 +1488,10 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.47 2000-01-20 00:23:03 pierre
|
||||
Revision 1.48 2000-01-23 16:36:37 peter
|
||||
* better auto RTL dir detection
|
||||
|
||||
Revision 1.47 2000/01/20 00:23:03 pierre
|
||||
* fix for GetShortName, now checks results from Win32
|
||||
|
||||
Revision 1.46 2000/01/07 01:14:27 peter
|
||||
|
@ -87,6 +87,7 @@ var
|
||||
read_configfile, { read config file, set when a cfgfile is found }
|
||||
target_is_set : boolean; { do not allow contradictory target settings }
|
||||
asm_is_set : boolean; { -T also change initoutputformat if not set idrectly }
|
||||
fpcdir,
|
||||
ppccfg,
|
||||
msgfilename,
|
||||
param_file : string; { file to compile specified on the commandline }
|
||||
@ -1367,12 +1368,32 @@ begin
|
||||
UnitSearchPath.AddPath(dos.getenv(target_info.unit_env),false);
|
||||
{$endif Delphi}
|
||||
{$ifdef linux}
|
||||
UnitSearchPath.AddPath('/usr/lib/fpc/'+version_string+'/units/'+lower(target_info.short_name),false);
|
||||
UnitSearchPath.AddPath('/usr/lib/fpc/'+version_string+'/units/'+lower(target_info.short_name)+'/rtl',false);
|
||||
fpcdir:=FixPath(getenv('FPCDIR'),false);
|
||||
if fpcdir='' then
|
||||
begin
|
||||
if PathExists('/usr/local/lib/fpc/'+version_string) then
|
||||
fpcidr:='/usr/local/lib/fpc/'+version_string
|
||||
else
|
||||
fpcdir:='/usr/lib/fpc/'+version_string;
|
||||
end;
|
||||
{$else}
|
||||
UnitSearchPath.AddPath(ExePath+'../units/'+lower(target_info.short_name),false);
|
||||
UnitSearchPath.AddPath(ExePath+'../units/'+lower(target_info.short_name)+'/rtl',false);
|
||||
fpcdir:=FixPath(getenv('FPCDIR'),false);
|
||||
if fpcdir='' then
|
||||
begin
|
||||
fpcdir:=ExePath+'../';
|
||||
if not(PathExists(fpcdir+'/units')) and
|
||||
not(PathExists(fpcdir+'/rtl')) then
|
||||
fpcdir:=fpcdir+'../';
|
||||
end;
|
||||
{$endif}
|
||||
{ first try development RTL, else use the default installation path }
|
||||
if PathExists(FpcDir+'rtl/'+lower(target_info.short_name)) then
|
||||
UnitSearchPath.AddPath(FpcDir+'rtl/'+lower(target_info.short_name),false)
|
||||
else
|
||||
begin
|
||||
UnitSearchPath.AddPath(FpcDir+'units/'+lower(target_info.short_name),false);
|
||||
UnitSearchPath.AddPath(FpcDir+'units/'+lower(target_info.short_name)+'/rtl',false);
|
||||
end;
|
||||
UnitSearchPath.AddPath(ExePath,false);
|
||||
{ Add unit dir to the object and library path }
|
||||
objectsearchpath.AddList(unitsearchpath,false);
|
||||
@ -1406,7 +1427,10 @@ end;
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.53 2000-01-20 10:36:44 daniel
|
||||
Revision 1.54 2000-01-23 16:36:37 peter
|
||||
* better auto RTL dir detection
|
||||
|
||||
Revision 1.53 2000/01/20 10:36:44 daniel
|
||||
* also support ; comments in cfg file
|
||||
|
||||
Revision 1.52 2000/01/17 22:50:28 peter
|
||||
|
Loading…
Reference in New Issue
Block a user