mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-07-21 15:16:06 +02:00
* merged filesearch() fix
This commit is contained in:
parent
a45f4354e3
commit
24fdea1ad0
@ -1262,7 +1262,7 @@ end;
|
|||||||
|
|
||||||
|
|
||||||
procedure djgpp_exception_setup;
|
procedure djgpp_exception_setup;
|
||||||
[alias : '___djgpp_exception_setup'];
|
[public,alias : '___djgpp_exception_setup'];
|
||||||
var
|
var
|
||||||
temp_kbd,
|
temp_kbd,
|
||||||
temp_npx : pointer;
|
temp_npx : pointer;
|
||||||
@ -1495,7 +1495,10 @@ end;
|
|||||||
{$endif IN_SYSTEM}
|
{$endif IN_SYSTEM}
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.7 2001-11-24 14:42:19 carl
|
Revision 1.8 2002-01-25 16:23:03 peter
|
||||||
|
* merged filesearch() fix
|
||||||
|
|
||||||
|
Revision 1.7 2001/11/24 14:42:19 carl
|
||||||
* completely moerged (except for smartlink option) from fixes branch
|
* completely moerged (except for smartlink option) from fixes branch
|
||||||
|
|
||||||
|
|
||||||
|
@ -429,12 +429,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
Function FileSearch (Const Name, DirList : String) : String;
|
|
||||||
begin
|
|
||||||
result := DOS.FSearch(Name, DirList);
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
{****************************************************************************
|
{****************************************************************************
|
||||||
Disk Functions
|
Disk Functions
|
||||||
****************************************************************************}
|
****************************************************************************}
|
||||||
@ -714,7 +708,10 @@ Finalization
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.7 2002-01-19 11:57:55 peter
|
Revision 1.8 2002-01-25 16:23:03 peter
|
||||||
|
* merged filesearch() fix
|
||||||
|
|
||||||
|
Revision 1.7 2002/01/19 11:57:55 peter
|
||||||
* merged fixes
|
* merged fixes
|
||||||
|
|
||||||
Revision 1.6 2001/10/25 21:23:49 peter
|
Revision 1.6 2001/10/25 21:23:49 peter
|
||||||
|
@ -28,6 +28,35 @@
|
|||||||
{ Read filename handling functions implementation }
|
{ Read filename handling functions implementation }
|
||||||
{$i fina.inc}
|
{$i fina.inc}
|
||||||
|
|
||||||
|
Function FileSearch (Const Name, DirList : String) : String;
|
||||||
|
Var
|
||||||
|
I : longint;
|
||||||
|
Temp : String;
|
||||||
|
begin
|
||||||
|
Result:='';
|
||||||
|
temp:=Dirlist;
|
||||||
|
repeat
|
||||||
|
While (Length(Temp)>0) and (Temp[1]=PathSeparator) do
|
||||||
|
Delete(Temp,1,1);
|
||||||
|
I:=pos(PathSep,Temp);
|
||||||
|
If I<>0 then
|
||||||
|
begin
|
||||||
|
Result:=Copy (Temp,1,i-1);
|
||||||
|
system.Delete(Temp,1,I);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
Result:=Temp;
|
||||||
|
Temp:='';
|
||||||
|
end;
|
||||||
|
If (Length(Result)>0) and (result[length(result)]<>DirectorySeparator) then
|
||||||
|
Result:=Result+DirectorySeparator;
|
||||||
|
Result:=Result+name;
|
||||||
|
If not FileExists(Result) Then
|
||||||
|
Result:='';
|
||||||
|
until (length(temp)=0) or (length(result)<>0);
|
||||||
|
end;
|
||||||
|
|
||||||
{ Read String Handling functions implementation }
|
{ Read String Handling functions implementation }
|
||||||
{$i sysstr.inc}
|
{$i sysstr.inc}
|
||||||
|
|
||||||
@ -330,7 +359,10 @@ end;
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.7 2001-10-22 21:40:55 peter
|
Revision 1.8 2002-01-25 16:23:03 peter
|
||||||
|
* merged filesearch() fix
|
||||||
|
|
||||||
|
Revision 1.7 2001/10/22 21:40:55 peter
|
||||||
* InterLocked routines added
|
* InterLocked routines added
|
||||||
|
|
||||||
Revision 1.6 2001/08/19 21:02:02 florian
|
Revision 1.6 2001/08/19 21:02:02 florian
|
||||||
|
@ -684,12 +684,6 @@ end;
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function FileSearch (const Name, DirList: string): string;
|
|
||||||
begin
|
|
||||||
Result := Dos.FSearch (Name, DirList);
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
{****************************************************************************
|
{****************************************************************************
|
||||||
Disk Functions
|
Disk Functions
|
||||||
****************************************************************************}
|
****************************************************************************}
|
||||||
@ -950,7 +944,10 @@ end.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.14 2001-12-16 19:08:20 hajny
|
Revision 1.15 2002-01-25 16:23:03 peter
|
||||||
|
* merged filesearch() fix
|
||||||
|
|
||||||
|
Revision 1.14 2001/12/16 19:08:20 hajny
|
||||||
* uses DosCalls replaced with direct declarations
|
* uses DosCalls replaced with direct declarations
|
||||||
|
|
||||||
Revision 1.13 2001/10/25 21:23:49 peter
|
Revision 1.13 2001/10/25 21:23:49 peter
|
||||||
|
@ -290,13 +290,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
Function FileSearch (Const Name, DirList : String) : String;
|
|
||||||
|
|
||||||
begin
|
|
||||||
FileSearch:=Unix.FSearch(Name,Dirlist);
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
{****************************************************************************
|
{****************************************************************************
|
||||||
Disk Functions
|
Disk Functions
|
||||||
****************************************************************************}
|
****************************************************************************}
|
||||||
@ -473,7 +466,10 @@ end.
|
|||||||
{
|
{
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.11 2001-10-25 21:23:49 peter
|
Revision 1.12 2002-01-25 16:23:03 peter
|
||||||
|
* merged filesearch() fix
|
||||||
|
|
||||||
|
Revision 1.11 2001/10/25 21:23:49 peter
|
||||||
* added 64bit fileseek
|
* added 64bit fileseek
|
||||||
|
|
||||||
Revision 1.10 2001/06/03 20:19:09 peter
|
Revision 1.10 2001/06/03 20:19:09 peter
|
||||||
|
@ -1,7 +1,12 @@
|
|||||||
|
{
|
||||||
|
$Id$
|
||||||
|
}
|
||||||
unit signals;
|
unit signals;
|
||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
|
{$PACKRECORDS C}
|
||||||
|
|
||||||
{ Signals }
|
{ Signals }
|
||||||
const
|
const
|
||||||
SIGABRT = 288;
|
SIGABRT = 288;
|
||||||
@ -112,7 +117,6 @@ interface
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
|
||||||
@ -169,20 +173,19 @@ var
|
|||||||
except_signal : array[0..Max_level-1] of longint;
|
except_signal : array[0..Max_level-1] of longint;
|
||||||
reset_fpu : array[0..max_level-1] of boolean;
|
reset_fpu : array[0..max_level-1] of boolean;
|
||||||
|
|
||||||
|
|
||||||
procedure JumpToHandleSignal;
|
procedure JumpToHandleSignal;
|
||||||
var
|
var
|
||||||
res, eip, ebp, sigtype : longint;
|
res, eip, _ebp, sigtype : longint;
|
||||||
begin
|
begin
|
||||||
asm
|
asm
|
||||||
pushal
|
|
||||||
movl (%ebp),%eax
|
movl (%ebp),%eax
|
||||||
movl %eax,ebp
|
movl %eax,_ebp
|
||||||
end;
|
end;
|
||||||
|
Writeln('In start of JumpToHandleSignal');
|
||||||
if except_level>0 then
|
if except_level>0 then
|
||||||
dec(except_level)
|
dec(except_level)
|
||||||
else
|
else
|
||||||
exit;
|
RunError(216);
|
||||||
eip:=except_eip[except_level];
|
eip:=except_eip[except_level];
|
||||||
|
|
||||||
sigtype:=except_signal[except_level];
|
sigtype:=except_signal[except_level];
|
||||||
@ -191,6 +194,12 @@ var
|
|||||||
fninit
|
fninit
|
||||||
fldcw fpucw
|
fldcw fpucw
|
||||||
end;
|
end;
|
||||||
|
if assigned(System_exception_frame) then
|
||||||
|
{ get the handler in front again }
|
||||||
|
asm
|
||||||
|
movl System_exception_frame,%eax
|
||||||
|
movl %eax,%fs:(0)
|
||||||
|
end;
|
||||||
if (sigtype>=SIGABRT) and (sigtype<=SIGMAX) and
|
if (sigtype>=SIGABRT) and (sigtype<=SIGMAX) and
|
||||||
(signal_list[sigtype]<>@SIG_DFL) then
|
(signal_list[sigtype]<>@SIG_DFL) then
|
||||||
begin
|
begin
|
||||||
@ -200,56 +209,68 @@ var
|
|||||||
res:=0;
|
res:=0;
|
||||||
|
|
||||||
if res=0 then
|
if res=0 then
|
||||||
RunError(sigtype)
|
Begin
|
||||||
|
Writeln('In JumpToHandleSignal');
|
||||||
|
RunError(sigtype);
|
||||||
|
end
|
||||||
else
|
else
|
||||||
{ jump back to old code }
|
{ jump back to old code }
|
||||||
asm
|
asm
|
||||||
popal
|
|
||||||
movl eip,%eax
|
movl eip,%eax
|
||||||
movl %eax,4(%ebp)
|
push %eax
|
||||||
|
movl _ebp,%eax
|
||||||
|
push %eax
|
||||||
|
leave
|
||||||
ret
|
ret
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function Signals_exception_handler(excep :PEXCEPTION_POINTERS) : longint;stdcall;
|
function Signals_exception_handler
|
||||||
|
(excep_exceptionrecord :PEXCEPTION_RECORD;
|
||||||
|
excep_frame : PEXCEPTION_FRAME;
|
||||||
|
excep_contextrecord : PCONTEXT;
|
||||||
|
dispatch : pointer) : longint;stdcall;
|
||||||
var frame,res : longint;
|
var frame,res : longint;
|
||||||
function CallSignal(sigtype,frame : longint;must_reset_fpu : boolean) : longint;
|
function CallSignal(sigtype,frame : longint;must_reset_fpu : boolean) : longint;
|
||||||
begin
|
begin
|
||||||
if frame=0 then
|
writeln(stderr,'CallSignal called');
|
||||||
CallSignal:=Exception_Continue_Search
|
{if frame=0 then
|
||||||
else
|
begin
|
||||||
|
CallSignal:=1;
|
||||||
|
writeln(stderr,'CallSignal frame is zero');
|
||||||
|
end
|
||||||
|
else }
|
||||||
begin
|
begin
|
||||||
if except_level >= Max_level then
|
if except_level >= Max_level then
|
||||||
exit;
|
exit;
|
||||||
except_eip[except_level]:=excep^.ContextRecord^.Eip;
|
except_eip[except_level]:=excep_ContextRecord^.Eip;
|
||||||
except_signal[except_level]:=sigtype;
|
except_signal[except_level]:=sigtype;
|
||||||
reset_fpu[except_level]:=must_reset_fpu;
|
reset_fpu[except_level]:=must_reset_fpu;
|
||||||
inc(except_level);
|
inc(except_level);
|
||||||
dec(excep^.ContextRecord^.Esp,4);
|
{dec(excep^.ContextRecord^.Esp,4);
|
||||||
plongint (excep^.ContextRecord^.Esp)^ := excep^.ContextRecord^.Eip;
|
plongint (excep^.ContextRecord^.Esp)^ := longint(excep^.ContextRecord^.Eip);}
|
||||||
excep^.ContextRecord^.Eip:=longint(@JumpToHandleSignal);
|
excep_ContextRecord^.Eip:=longint(@JumpToHandleSignal);
|
||||||
CallSignal:=Exception_Continue_Execution;
|
excep_ExceptionRecord^.ExceptionCode:=0;
|
||||||
|
CallSignal:=0;
|
||||||
|
writeln(stderr,'Exception_Continue_Execution set');
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
{$ifdef i386}
|
if excep_ContextRecord^.SegSs=_SS then
|
||||||
if excep^.ContextRecord^.SegSs=_SS then
|
frame:=excep_ContextRecord^.Ebp
|
||||||
frame:=excep^.ContextRecord^.Ebp
|
|
||||||
else
|
else
|
||||||
{$endif i386}
|
|
||||||
frame:=0;
|
frame:=0;
|
||||||
{ default : unhandled !}
|
{ default : unhandled !}
|
||||||
res:=Exception_Continue_Search;
|
res:=1;
|
||||||
{$ifdef SYSTEMEXCEPTIONDEBUG}
|
{$ifdef SYSTEMEXCEPTIONDEBUG}
|
||||||
if IsConsole then
|
if IsConsole then
|
||||||
writeln(stderr,'Exception ',
|
writeln(stderr,'Signals exception ',
|
||||||
hexstr(excep^.ExceptionRecord^.ExceptionCode,8));
|
hexstr(excep_ExceptionRecord^.ExceptionCode,8));
|
||||||
{$endif SYSTEMEXCEPTIONDEBUG}
|
{$endif SYSTEMEXCEPTIONDEBUG}
|
||||||
case excep^.ExceptionRecord^.ExceptionCode of
|
case excep_ExceptionRecord^.ExceptionCode of
|
||||||
EXCEPTION_ACCESS_VIOLATION :
|
EXCEPTION_ACCESS_VIOLATION :
|
||||||
res:=CallSignal(SIGSEGV,frame,false);
|
res:=CallSignal(SIGSEGV,frame,false);
|
||||||
{ EXCEPTION_BREAKPOINT = $80000003;
|
{ EXCEPTION_BREAKPOINT = $80000003;
|
||||||
@ -303,6 +324,21 @@ var
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function API_signals_exception_handler(except : PEXCEPTION_POINTERS) : longint;
|
||||||
|
begin
|
||||||
|
API_signals_exception_handler:=Signals_exception_handler(
|
||||||
|
@except^.ExceptionRecord,
|
||||||
|
nil,
|
||||||
|
@except^.ContextRecord,
|
||||||
|
nil);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
const
|
||||||
|
PreviousHandler : LPTOP_LEVEL_EXCEPTION_FILTER = nil;
|
||||||
|
Prev_Handler : pointer = nil;
|
||||||
|
Prev_fpc_handler : pointer = nil;
|
||||||
|
|
||||||
procedure install_exception_handler;
|
procedure install_exception_handler;
|
||||||
{$ifdef SYSTEMEXCEPTIONDEBUG}
|
{$ifdef SYSTEMEXCEPTIONDEBUG}
|
||||||
var
|
var
|
||||||
@ -311,6 +347,20 @@ var
|
|||||||
begin
|
begin
|
||||||
if Exception_handler_installed then
|
if Exception_handler_installed then
|
||||||
exit;
|
exit;
|
||||||
|
if assigned(System_exception_frame) then
|
||||||
|
begin
|
||||||
|
prev_fpc_handler:=System_exception_frame^.handler;
|
||||||
|
System_exception_frame^.handler:=@Signals_exception_handler;
|
||||||
|
{ get the handler in front again }
|
||||||
|
asm
|
||||||
|
movl %fs:(0),%eax
|
||||||
|
movl %eax,prev_handler
|
||||||
|
movl System_exception_frame,%eax
|
||||||
|
movl %eax,%fs:(0)
|
||||||
|
end;
|
||||||
|
Exception_handler_installed:=true;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
{$ifdef SYSTEMEXCEPTIONDEBUG}
|
{$ifdef SYSTEMEXCEPTIONDEBUG}
|
||||||
asm
|
asm
|
||||||
movl $0,%eax
|
movl $0,%eax
|
||||||
@ -318,7 +368,7 @@ var
|
|||||||
movl %eax,oldexceptaddr
|
movl %eax,oldexceptaddr
|
||||||
end;
|
end;
|
||||||
{$endif SYSTEMEXCEPTIONDEBUG}
|
{$endif SYSTEMEXCEPTIONDEBUG}
|
||||||
SetUnhandledExceptionFilter(@Signals_exception_handler);
|
PreviousHandler:=SetUnhandledExceptionFilter(@API_signals_exception_handler);
|
||||||
{$ifdef SYSTEMEXCEPTIONDEBUG}
|
{$ifdef SYSTEMEXCEPTIONDEBUG}
|
||||||
asm
|
asm
|
||||||
movl $0,%eax
|
movl $0,%eax
|
||||||
@ -326,8 +376,11 @@ var
|
|||||||
movl %eax,newexceptaddr
|
movl %eax,newexceptaddr
|
||||||
end;
|
end;
|
||||||
if IsConsole then
|
if IsConsole then
|
||||||
|
begin
|
||||||
writeln(stderr,'Old exception ',hexstr(oldexceptaddr,8),
|
writeln(stderr,'Old exception ',hexstr(oldexceptaddr,8),
|
||||||
' new exception ',hexstr(newexceptaddr,8));
|
' new exception ',hexstr(newexceptaddr,8));
|
||||||
|
writeln('SetUnhandledExceptionFilter returned ',hexstr(longint(PreviousHandler),8));
|
||||||
|
end;
|
||||||
{$endif SYSTEMEXCEPTIONDEBUG}
|
{$endif SYSTEMEXCEPTIONDEBUG}
|
||||||
Exception_handler_installed := true;
|
Exception_handler_installed := true;
|
||||||
end;
|
end;
|
||||||
@ -336,7 +389,24 @@ var
|
|||||||
begin
|
begin
|
||||||
if not Exception_handler_installed then
|
if not Exception_handler_installed then
|
||||||
exit;
|
exit;
|
||||||
SetUnhandledExceptionFilter(nil);
|
if assigned(System_exception_frame) then
|
||||||
|
begin
|
||||||
|
if assigned(prev_fpc_handler) then
|
||||||
|
System_exception_frame^.handler:=prev_fpc_handler;
|
||||||
|
prev_fpc_handler:=nil;
|
||||||
|
{ restore old handler order again }
|
||||||
|
if assigned(prev_handler) then
|
||||||
|
asm
|
||||||
|
movl prev_handler,%eax
|
||||||
|
movl %eax,%fs:(0)
|
||||||
|
end;
|
||||||
|
prev_handler:=nil;
|
||||||
|
Exception_handler_installed:=false;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
SetUnhandledExceptionFilter(PreviousHandler);
|
||||||
|
PreviousHandler:=nil;
|
||||||
|
Exception_handler_installed:=false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -378,13 +448,11 @@ var
|
|||||||
i : longint;
|
i : longint;
|
||||||
initialization
|
initialization
|
||||||
|
|
||||||
{$ifdef i386}
|
|
||||||
asm
|
asm
|
||||||
xorl %eax,%eax
|
xorl %eax,%eax
|
||||||
movw %ss,%ax
|
movw %ss,%ax
|
||||||
movl %eax,_SS
|
movl %eax,_SS
|
||||||
end;
|
end;
|
||||||
{$endif i386}
|
|
||||||
|
|
||||||
for i:=SIGABRT to SIGMAX do
|
for i:=SIGABRT to SIGMAX do
|
||||||
signal_list[i]:=@SIG_DFL;
|
signal_list[i]:=@SIG_DFL;
|
||||||
@ -397,3 +465,9 @@ finalization
|
|||||||
|
|
||||||
remove_exception_handler;
|
remove_exception_handler;
|
||||||
end.
|
end.
|
||||||
|
{
|
||||||
|
$Log$
|
||||||
|
Revision 1.4 2002-01-25 16:23:03 peter
|
||||||
|
* merged filesearch() fix
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -71,6 +71,7 @@ const
|
|||||||
|
|
||||||
{ Thread count for DLL }
|
{ Thread count for DLL }
|
||||||
Thread_count : longint = 0;
|
Thread_count : longint = 0;
|
||||||
|
System_exception_frame : PEXCEPTION_FRAME =nil;
|
||||||
|
|
||||||
type
|
type
|
||||||
TStartupInfo=packed record
|
TStartupInfo=packed record
|
||||||
@ -94,6 +95,12 @@ type
|
|||||||
hStdError : longint;
|
hStdError : longint;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
PEXCEPTION_FRAME = ^TEXCEPTION_FRAME;
|
||||||
|
TEXCEPTION_FRAME = record
|
||||||
|
next : PEXCEPTION_FRAME;
|
||||||
|
handler : pointer;
|
||||||
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
{ C compatible arguments }
|
{ C compatible arguments }
|
||||||
argc : longint;
|
argc : longint;
|
||||||
@ -976,6 +983,15 @@ procedure Exe_entry;[public, alias : '_FPC_EXE_Entry'];
|
|||||||
{ This strange construction is needed to solve the _SS problem
|
{ This strange construction is needed to solve the _SS problem
|
||||||
with a smartlinked syswin32 (PFV) }
|
with a smartlinked syswin32 (PFV) }
|
||||||
asm
|
asm
|
||||||
|
{ allocate space for an excption frame }
|
||||||
|
pushl $0
|
||||||
|
pushl %fs:(0)
|
||||||
|
{ movl %esp,%fs:(0)
|
||||||
|
but don't insert it as it doesn't
|
||||||
|
point to anything yet
|
||||||
|
this will be used in signals unit }
|
||||||
|
movl %esp,%eax
|
||||||
|
movl %eax,System_exception_frame
|
||||||
pushl %ebp
|
pushl %ebp
|
||||||
xorl %ebp,%ebp
|
xorl %ebp,%ebp
|
||||||
movl %esp,%eax
|
movl %esp,%eax
|
||||||
@ -1567,7 +1583,10 @@ end.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.22 2001-12-02 17:21:25 peter
|
Revision 1.23 2002-01-25 16:23:03 peter
|
||||||
|
* merged filesearch() fix
|
||||||
|
|
||||||
|
Revision 1.22 2001/12/02 17:21:25 peter
|
||||||
* merged fixes from 1.0
|
* merged fixes from 1.0
|
||||||
|
|
||||||
Revision 1.21 2001/11/08 16:16:54 florian
|
Revision 1.21 2001/11/08 16:16:54 florian
|
||||||
|
@ -273,40 +273,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
Function FileSearch (Const Name, DirList : String) : String;
|
|
||||||
Var
|
|
||||||
I : longint;
|
|
||||||
Temp : String;
|
|
||||||
begin
|
|
||||||
{ check if the file specified exists }
|
|
||||||
If FileExists(Name) Then
|
|
||||||
begin
|
|
||||||
Result:=Name;
|
|
||||||
exit;
|
|
||||||
end;
|
|
||||||
Result:='';
|
|
||||||
temp:=Dirlist;
|
|
||||||
repeat
|
|
||||||
I:=pos(';',Temp);
|
|
||||||
If I<>0 then
|
|
||||||
begin
|
|
||||||
Result:=Copy (Temp,1,i-1);
|
|
||||||
system.Delete(Temp,1,I);
|
|
||||||
end
|
|
||||||
else
|
|
||||||
begin
|
|
||||||
Result:=Temp;
|
|
||||||
Temp:='';
|
|
||||||
end;
|
|
||||||
If (result<>'') and (result[length(result)]<>'\') then
|
|
||||||
Result:=Result+'\';
|
|
||||||
Result:=Result+name;
|
|
||||||
If not FileExists(Result) Then
|
|
||||||
Result:='';
|
|
||||||
until (Temp='') or (Result<>'');
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
{****************************************************************************
|
{****************************************************************************
|
||||||
Disk Functions
|
Disk Functions
|
||||||
****************************************************************************}
|
****************************************************************************}
|
||||||
@ -686,7 +652,10 @@ Finalization
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.11 2001-12-11 23:10:18 carl
|
Revision 1.12 2002-01-25 16:23:04 peter
|
||||||
|
* merged filesearch() fix
|
||||||
|
|
||||||
|
Revision 1.11 2001/12/11 23:10:18 carl
|
||||||
* Range check error fix
|
* Range check error fix
|
||||||
|
|
||||||
Revision 1.10 2001/10/25 21:23:49 peter
|
Revision 1.10 2001/10/25 21:23:49 peter
|
||||||
|
Loading…
Reference in New Issue
Block a user