|
@@ -17,6 +17,7 @@
|
|
Unit Redir;
|
|
Unit Redir;
|
|
Interface
|
|
Interface
|
|
|
|
|
|
|
|
+{$H+}
|
|
{$R-}
|
|
{$R-}
|
|
{$ifndef Linux}
|
|
{$ifndef Linux}
|
|
{$ifndef Unix}
|
|
{$ifndef Unix}
|
|
@@ -89,6 +90,10 @@ const
|
|
|
|
|
|
Implementation
|
|
Implementation
|
|
|
|
|
|
|
|
+{$ifdef macos}
|
|
|
|
+{$define usedos}
|
|
|
|
+{$endif}
|
|
|
|
+
|
|
Uses
|
|
Uses
|
|
{$ifdef go32v2}
|
|
{$ifdef go32v2}
|
|
go32,
|
|
go32,
|
|
@@ -104,7 +109,11 @@ Uses
|
|
unix,
|
|
unix,
|
|
{$endif}
|
|
{$endif}
|
|
{$endif unix}
|
|
{$endif unix}
|
|
|
|
+{$ifdef usedos}
|
|
dos;
|
|
dos;
|
|
|
|
+{$else}
|
|
|
|
+ sysutils;
|
|
|
|
+{$endif}
|
|
|
|
|
|
Const
|
|
Const
|
|
{$ifdef UNIX}
|
|
{$ifdef UNIX}
|
|
@@ -123,6 +132,31 @@ Const
|
|
{$endif MACOS}
|
|
{$endif MACOS}
|
|
{$endif UNIX}
|
|
{$endif UNIX}
|
|
|
|
|
|
|
|
+{$ifndef usedos}
|
|
|
|
+{ code from: }
|
|
|
|
+{ Lithuanian Text Tool version 0.9.0 (2001-04-19) }
|
|
|
|
+{ Copyright (c) 1999-2001 Marius Gedminas <[email protected]> }
|
|
|
|
+{ (GPLv2 or later) }
|
|
|
|
+
|
|
|
|
+function FExpand(const S: string): string;
|
|
|
|
+begin
|
|
|
|
+ FExpand := ExpandFileName(S);
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+type
|
|
|
|
+ PathStr = string;
|
|
|
|
+ DirStr = string;
|
|
|
|
+ NameStr = string;
|
|
|
|
+ ExtStr = string;
|
|
|
|
+
|
|
|
|
+procedure FSplit(Path: PathStr; var Dir: DirStr; var Name: NameStr; var Ext: ExtStr);
|
|
|
|
+begin
|
|
|
|
+ Dir := ExtractFilePath(Path);
|
|
|
|
+ Name := ChangeFileExt(ExtractFileName(Path), '');
|
|
|
|
+ Ext := ExtractFileExt(Path);
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+{$endif}
|
|
|
|
|
|
var
|
|
var
|
|
FIN,FOUT,FERR : ^File;
|
|
FIN,FOUT,FERR : ^File;
|
|
@@ -142,12 +176,12 @@ var
|
|
i : longint;
|
|
i : longint;
|
|
begin
|
|
begin
|
|
{ Fix separator }
|
|
{ Fix separator }
|
|
|
|
+ setlength(fixpath,length(s));
|
|
for i:=1 to length(s) do
|
|
for i:=1 to length(s) do
|
|
if s[i] in ['/','\'] then
|
|
if s[i] in ['/','\'] then
|
|
fixpath[i]:=DirSep
|
|
fixpath[i]:=DirSep
|
|
else
|
|
else
|
|
fixpath[i]:=s[i];
|
|
fixpath[i]:=s[i];
|
|
- fixpath[0]:=s[0];
|
|
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
@@ -280,13 +314,19 @@ end;
|
|
|
|
|
|
{$I-}
|
|
{$I-}
|
|
function FileExist(const FileName : PathStr) : Boolean;
|
|
function FileExist(const FileName : PathStr) : Boolean;
|
|
|
|
+{$ifdef usedos}
|
|
var
|
|
var
|
|
f : file;
|
|
f : file;
|
|
Attr : word;
|
|
Attr : word;
|
|
|
|
+{$endif}
|
|
begin
|
|
begin
|
|
|
|
+{$ifdef usedos}
|
|
Assign(f, FileName);
|
|
Assign(f, FileName);
|
|
GetFAttr(f, Attr);
|
|
GetFAttr(f, Attr);
|
|
FileExist := DosError = 0;
|
|
FileExist := DosError = 0;
|
|
|
|
+{$else}
|
|
|
|
+ FileExist := Sysutils.FileExists(filename);
|
|
|
|
+{$endif}
|
|
end;
|
|
end;
|
|
|
|
|
|
function CompleteDir(const Path: string): string;
|
|
function CompleteDir(const Path: string): string;
|
|
@@ -321,7 +361,11 @@ begin
|
|
Exit;
|
|
Exit;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+{$ifdef usedos}
|
|
S:=GetEnv('PATH');
|
|
S:=GetEnv('PATH');
|
|
|
|
+{$else}
|
|
|
|
+ S:=GetEnvironmentVariable('PATH');
|
|
|
|
+{$endif}
|
|
While Length(S)>0 do
|
|
While Length(S)>0 do
|
|
begin
|
|
begin
|
|
i:=1;
|
|
i:=1;
|
|
@@ -963,7 +1007,9 @@ end;
|
|
{$IfDef MsDos}
|
|
{$IfDef MsDos}
|
|
SmallHeap;
|
|
SmallHeap;
|
|
{$EndIf MsDos}
|
|
{$EndIf MsDos}
|
|
|
|
+{$ifdef usedos}
|
|
SwapVectors;
|
|
SwapVectors;
|
|
|
|
+{$endif usedos}
|
|
{ Must use shell() for linux for the wildcard expansion (PFV) }
|
|
{ Must use shell() for linux for the wildcard expansion (PFV) }
|
|
{$ifdef UNIX}
|
|
{$ifdef UNIX}
|
|
IOStatus:=0;
|
|
IOStatus:=0;
|
|
@@ -991,12 +1037,12 @@ end;
|
|
{$endif windows}
|
|
{$endif windows}
|
|
DosError:=0;
|
|
DosError:=0;
|
|
If UseComSpec then
|
|
If UseComSpec then
|
|
- Dos.Exec (Getenv('COMSPEC'),'/C '+FixPath(progname)+' '+Comline)
|
|
|
|
|
|
+ Sysutils.ExecuteProcess (Getenv('COMSPEC'),'/C '+FixPath(progname)+' '+Comline)
|
|
else
|
|
else
|
|
begin
|
|
begin
|
|
if LocateExeFile(progname) then
|
|
if LocateExeFile(progname) then
|
|
{$ifndef macos}
|
|
{$ifndef macos}
|
|
- Dos.Exec(ProgName,Comline)
|
|
|
|
|
|
+ Sysutils.ExecuteProcess(ProgName,Comline)
|
|
{$else}
|
|
{$else}
|
|
Dos.Exec(''''+ProgName+'''',Comline) {Quotes needed !}
|
|
Dos.Exec(''''+ProgName+'''',Comline) {Quotes needed !}
|
|
{$endif}
|
|
{$endif}
|
|
@@ -1010,7 +1056,9 @@ end;
|
|
IOStatus:=DosError;
|
|
IOStatus:=DosError;
|
|
ExecuteResult:=DosExitCode;
|
|
ExecuteResult:=DosExitCode;
|
|
{$endif}
|
|
{$endif}
|
|
|
|
+{$ifdef usedos}
|
|
SwapVectors;
|
|
SwapVectors;
|
|
|
|
+{$endif}
|
|
{$ifdef CPU86}
|
|
{$ifdef CPU86}
|
|
{ reset the FPU }
|
|
{ reset the FPU }
|
|
{$asmmode att}
|
|
{$asmmode att}
|