|
@@ -243,7 +243,7 @@ unit globals;
|
|
function filetimestring( t : longint) : string;
|
|
function filetimestring( t : longint) : string;
|
|
|
|
|
|
procedure DefaultReplacements(var s:string);
|
|
procedure DefaultReplacements(var s:string);
|
|
-
|
|
|
|
|
|
+ function GetCurrentDir:string;
|
|
function path_absolute(const s : string) : boolean;
|
|
function path_absolute(const s : string) : boolean;
|
|
Function PathExists ( F : String) : Boolean;
|
|
Function PathExists ( F : String) : Boolean;
|
|
Function FileExists ( Const F : String) : Boolean;
|
|
Function FileExists ( Const F : String) : Boolean;
|
|
@@ -756,6 +756,7 @@ implementation
|
|
filetimestring:=L0(Year)+'/'+L0(Month)+'/'+L0(Day)+' '+L0(Hour)+':'+L0(min)+':'+L0(sec);
|
|
filetimestring:=L0(Year)+'/'+L0(Month)+'/'+L0(Day)+' '+L0(Hour)+':'+L0(min)+':'+L0(sec);
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+
|
|
{****************************************************************************
|
|
{****************************************************************************
|
|
Default Macro Handling
|
|
Default Macro Handling
|
|
****************************************************************************}
|
|
****************************************************************************}
|
|
@@ -777,6 +778,15 @@ implementation
|
|
File Handling
|
|
File Handling
|
|
****************************************************************************}
|
|
****************************************************************************}
|
|
|
|
|
|
|
|
+ function GetCurrentDir:string;
|
|
|
|
+ var
|
|
|
|
+ CurrentDir : string;
|
|
|
|
+ begin
|
|
|
|
+ GetDir(0,CurrentDir);
|
|
|
|
+ GetCurrentDir:=FixPath(CurrentDir,false);
|
|
|
|
+ end;
|
|
|
|
+
|
|
|
|
+
|
|
function path_absolute(const s : string) : boolean;
|
|
function path_absolute(const s : string) : boolean;
|
|
{
|
|
{
|
|
is path s an absolute path?
|
|
is path s an absolute path?
|
|
@@ -803,31 +813,24 @@ implementation
|
|
Begin
|
|
Begin
|
|
End;
|
|
End;
|
|
{$endif not FPC}
|
|
{$endif not FPC}
|
|
-{$ifdef delphi}
|
|
|
|
- Function FileExists ( Const F : String) : Boolean;
|
|
|
|
|
|
|
|
- begin
|
|
|
|
- FileExists:=sysutils.FileExists(f);
|
|
|
|
- end;
|
|
|
|
|
|
|
|
-{$else}
|
|
|
|
Function FileExists ( Const F : String) : Boolean;
|
|
Function FileExists ( Const F : String) : Boolean;
|
|
|
|
+{$ifndef delphi}
|
|
Var
|
|
Var
|
|
- {$ifdef linux}
|
|
|
|
- Info : Stat;
|
|
|
|
- {$else}
|
|
|
|
Info : SearchRec;
|
|
Info : SearchRec;
|
|
- {$endif}
|
|
|
|
|
|
+{$endif}
|
|
begin
|
|
begin
|
|
- {$ifdef linux}
|
|
|
|
- FileExists:=FStat(F,info);
|
|
|
|
- {$else}
|
|
|
|
|
|
+{$ifdef delphi}
|
|
|
|
+ FileExists:=sysutils.FileExists(f);
|
|
|
|
+{$else}
|
|
findfirst(F,readonly+archive+hidden,info);
|
|
findfirst(F,readonly+archive+hidden,info);
|
|
FileExists:=(doserror=0);
|
|
FileExists:=(doserror=0);
|
|
findclose(Info);
|
|
findclose(Info);
|
|
- {$endif}
|
|
|
|
|
|
+{$endif delphi}
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+
|
|
Function PathExists ( F : String) : Boolean;
|
|
Function PathExists ( F : String) : Boolean;
|
|
Var
|
|
Var
|
|
Info : SearchRec;
|
|
Info : SearchRec;
|
|
@@ -838,7 +841,6 @@ implementation
|
|
PathExists:=(doserror=0) and ((info.attr and directory)=directory);
|
|
PathExists:=(doserror=0) and ((info.attr and directory)=directory);
|
|
findclose(Info);
|
|
findclose(Info);
|
|
end;
|
|
end;
|
|
-{$endif}
|
|
|
|
|
|
|
|
|
|
|
|
Function RemoveFile(const f:string):boolean;
|
|
Function RemoveFile(const f:string):boolean;
|
|
@@ -1003,6 +1005,7 @@ implementation
|
|
{$endif}
|
|
{$endif}
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+
|
|
procedure SplitBinCmd(const s:string;var bstr,cstr:string);
|
|
procedure SplitBinCmd(const s:string;var bstr,cstr:string);
|
|
var
|
|
var
|
|
i : longint;
|
|
i : longint;
|
|
@@ -1053,14 +1056,29 @@ implementation
|
|
{ Support default macro's }
|
|
{ Support default macro's }
|
|
DefaultReplacements(s);
|
|
DefaultReplacements(s);
|
|
{ get current dir }
|
|
{ get current dir }
|
|
- GetDir(0,CurrentDir);
|
|
|
|
- CurrentDir:=FixPath(CurrentDir,false);
|
|
|
|
|
|
+ CurrentDir:=GetCurrentDir;
|
|
repeat
|
|
repeat
|
|
- j:=Pos(';',s);
|
|
|
|
- if j=0 then
|
|
|
|
- j:=255;
|
|
|
|
- {Get Pathname}
|
|
|
|
- CurrPath:=FixPath(Copy(s,1,j-1),false);
|
|
|
|
|
|
+ { get currpath }
|
|
|
|
+ if addfirst then
|
|
|
|
+ begin
|
|
|
|
+ j:=length(s);
|
|
|
|
+ while (j>0) and (s[j]<>';') do
|
|
|
|
+ dec(j);
|
|
|
|
+ CurrPath:=FixPath(Copy(s,j+1,length(s)-j),false);
|
|
|
|
+ if j=0 then
|
|
|
|
+ s:=''
|
|
|
|
+ else
|
|
|
|
+ System.Delete(s,j,length(s)-j+1);
|
|
|
|
+ end
|
|
|
|
+ else
|
|
|
|
+ begin
|
|
|
|
+ j:=Pos(';',s);
|
|
|
|
+ if j=0 then
|
|
|
|
+ j:=255;
|
|
|
|
+ CurrPath:=FixPath(Copy(s,1,j-1),false);
|
|
|
|
+ System.Delete(s,1,j);
|
|
|
|
+ end;
|
|
|
|
+ { fix pathname }
|
|
if CurrPath='' then
|
|
if CurrPath='' then
|
|
CurrPath:='.'+DirSep
|
|
CurrPath:='.'+DirSep
|
|
else
|
|
else
|
|
@@ -1069,7 +1087,7 @@ implementation
|
|
if (Copy(CurrPath,1,length(CurrentDir))=CurrentDir) then
|
|
if (Copy(CurrPath,1,length(CurrentDir))=CurrentDir) then
|
|
CurrPath:='.'+DirSep+Copy(CurrPath,length(CurrentDir)+1,255);
|
|
CurrPath:='.'+DirSep+Copy(CurrPath,length(CurrentDir)+1,255);
|
|
end;
|
|
end;
|
|
- System.Delete(s,1,j);
|
|
|
|
|
|
+ { wildcard adding ? }
|
|
if pos('*',currpath)>0 then
|
|
if pos('*',currpath)>0 then
|
|
begin
|
|
begin
|
|
if currpath[length(currpath)]=dirsep then
|
|
if currpath[length(currpath)]=dirsep then
|
|
@@ -1091,15 +1109,13 @@ implementation
|
|
end;
|
|
end;
|
|
findnext(dir);
|
|
findnext(dir);
|
|
end;
|
|
end;
|
|
-{$ifdef Linux}
|
|
|
|
- FindClose(dir);
|
|
|
|
-{$endif}
|
|
|
|
-{$ifdef Win32}
|
|
|
|
FindClose(dir);
|
|
FindClose(dir);
|
|
-{$endif}
|
|
|
|
end
|
|
end
|
|
else
|
|
else
|
|
- addcurrpath;
|
|
|
|
|
|
+ begin
|
|
|
|
+ if PathExists(currpath) then
|
|
|
|
+ addcurrpath;
|
|
|
|
+ end;
|
|
until (s='');
|
|
until (s='');
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -1240,6 +1256,7 @@ implementation
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+
|
|
function FindFile(const f : string;path : string;var b : boolean) : string;
|
|
function FindFile(const f : string;path : string;var b : boolean) : string;
|
|
Var
|
|
Var
|
|
singlepathstring : string;
|
|
singlepathstring : string;
|
|
@@ -1352,6 +1369,7 @@ implementation
|
|
{$endif}
|
|
{$endif}
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+
|
|
procedure FreeEnvPChar(p:pchar);
|
|
procedure FreeEnvPChar(p:pchar);
|
|
begin
|
|
begin
|
|
{$ifndef linux}
|
|
{$ifndef linux}
|
|
@@ -1375,9 +1393,10 @@ implementation
|
|
end;
|
|
end;
|
|
{$endif}
|
|
{$endif}
|
|
|
|
|
|
- {****************************************************************************
|
|
|
|
|
|
+
|
|
|
|
+{****************************************************************************
|
|
Init
|
|
Init
|
|
- ****************************************************************************}
|
|
|
|
|
|
+****************************************************************************}
|
|
|
|
|
|
procedure get_exepath;
|
|
procedure get_exepath;
|
|
var
|
|
var
|
|
@@ -1391,10 +1410,12 @@ implementation
|
|
{$endif delphi}
|
|
{$endif delphi}
|
|
if exepath='' then
|
|
if exepath='' then
|
|
fsplit(FixFileName(paramstr(0)),exepath,hs1,hs2);
|
|
fsplit(FixFileName(paramstr(0)),exepath,hs1,hs2);
|
|
|
|
+{$ifndef VER0_99_15}
|
|
{$ifdef linux}
|
|
{$ifdef linux}
|
|
if exepath='' then
|
|
if exepath='' then
|
|
fsearch(hs1,dos.getenv('PATH'));
|
|
fsearch(hs1,dos.getenv('PATH'));
|
|
{$endif}
|
|
{$endif}
|
|
|
|
+{$endif}
|
|
exepath:=FixPath(exepath,false);
|
|
exepath:=FixPath(exepath,false);
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -1492,7 +1513,14 @@ begin
|
|
end.
|
|
end.
|
|
{
|
|
{
|
|
$Log$
|
|
$Log$
|
|
- Revision 1.51 2000-02-09 13:22:53 peter
|
|
|
|
|
|
+ Revision 1.52 2000-02-10 11:45:48 peter
|
|
|
|
+ * addpath fixed with list of paths when inserting at the beginning
|
|
|
|
+ * if exepath=currentdir then it's not inserted in path list
|
|
|
|
+ * searchpaths in ppc386.cfg are now added at the beginning of the
|
|
|
|
+ list instead of at the end. (commandline is not changed)
|
|
|
|
+ * check paths before inserting in list
|
|
|
|
+
|
|
|
|
+ Revision 1.51 2000/02/09 13:22:53 peter
|
|
* log truncated
|
|
* log truncated
|
|
|
|
|
|
Revision 1.50 2000/01/26 14:31:03 marco
|
|
Revision 1.50 2000/01/26 14:31:03 marco
|