* better PathExists, fix for too long command line, correction of message

This commit is contained in:
Tomas Hajny 2004-09-21 23:33:43 +00:00
parent a7efa4937f
commit 5df0c00360
5 changed files with 190 additions and 198 deletions

View File

@ -589,39 +589,24 @@ implementation
Function PathExists ( F : String) : Boolean;
Var
Info : SearchRec;
disk : byte;
FF : file;
A: word;
I: longint;
begin
if F='' then
if F = '' then
begin
result:=true;
PathExists := true;
exit;
end;
{ these operating systems have dos type drives }
if source_info.system in [system_m68k_atari,system_i386_go32v2,
system_i386_win32,system_i386_os2,
system_i386_emx,system_i386_wdosx] then
Begin
if (Length(f)=3) and (F[2]=':') and (F[3] in ['/','\']) then
begin
if F[1] in ['A'..'Z'] then
disk:=ord(F[1])-ord('A')+1
else if F[1] in ['a'..'z'] then
disk:=ord(F[1])-ord('a')+1
else
disk:=255;
if disk=255 then
PathExists:=false
else
PathExists:=(DiskSize(disk)<>-1);
exit;
end;
end;
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);
F := FExpand (F);
I := Pos (DriveSeparator, F);
if (F [Length (F)] = DirectorySeparator)
and (((I = 0) and (Length (F) > 1)) or (I <> Length (F) - 1))
then
Delete (F, Length (F), 1);
Assign (FF, FExpand (F));
GetFAttr (FF, A);
PathExists := (DosError = 0) and (A and Directory = Directory);
end;
@ -2045,7 +2030,10 @@ implementation
end.
{
$Log$
Revision 1.140 2004-09-21 19:59:51 peter
Revision 1.141 2004-09-21 23:33:43 hajny
* better PathExists, fix for too long command line, correction of message
Revision 1.140 2004/09/21 19:59:51 peter
* x86_64 fixes
* cleanup of fpcdefs.icn

View File

@ -110,8 +110,8 @@ general_i_note=01015_I_Note:
% Prefix for Notes
general_i_hint=01016_I_Hint:
% Prefix for Hints
general_e_path_does_not_exists=01017_E_Path "$1" does not exists
% The specified path does not exists.
general_e_path_does_not_exist=01017_E_Path "$1" does not exist
% The specified path does not exist.
% \end{description}
#
# Scanner

View File

@ -16,7 +16,7 @@ const
general_i_warning=01014;
general_i_note=01015;
general_i_hint=01016;
general_e_path_does_not_exists=01017;
general_e_path_does_not_exist=01017;
scan_f_end_of_file=02000;
scan_f_string_exceeds_line=02001;
scan_f_illegal_char=02002;
@ -645,7 +645,7 @@ const
option_info=11024;
option_help_pages=11025;
MsgTxtSize = 36978;
MsgTxtSize = 36977;
MsgIdxMax : array[1..20] of longint=(
18,66,209,59,57,46,99,20,35,60,

File diff suppressed because it is too large Load Diff

View File

@ -643,7 +643,7 @@ begin
end;
'e' :
exepath:=FixPath(FExpand(More),true);
exepath:=FixPath(More,true);
'E' :
begin
@ -667,11 +667,11 @@ begin
initsourcecodepage:=more;
end;
'D' :
utilsdirectory:=FixPath(FExpand(More),true);
utilsdirectory:=FixPath(More,true);
'e' :
SetRedirectFile(More);
'E' :
OutputExeDir:=FixPath(FExpand(More),true);
OutputExeDir:=FixPath(More,true);
'i' :
begin
if ispara then
@ -712,7 +712,7 @@ begin
unitsearchpath.AddPath(More,true);
end;
'U' :
OutputUnitDir:=FixPath(FExpand(More),true);
OutputUnitDir:=FixPath(More,true);
else
IllegalPara(opt);
end;
@ -1698,6 +1698,7 @@ begin
def_symbol('HASOUT');
def_symbol('HASGLOBALPROPERTY');
def_symbol('FPC_HASPREFETCH');
def_symbol('FPC_LINEEND_IN_TEXTREC');
{$ifdef i386}
def_symbol('HASINTF');
def_symbol('HASVARIANT');
@ -1949,7 +1950,7 @@ begin
if (OutputExeDir<>'') and
not PathExists(OutputExeDir) then
begin
Message1(general_e_path_does_not_exists,OutputExeDir);
Message1(general_e_path_does_not_exist,OutputExeDir);
StopOptions(1);
end;
@ -2089,7 +2090,10 @@ finalization
end.
{
$Log$
Revision 1.143 2004-09-21 17:25:12 peter
Revision 1.144 2004-09-21 23:33:43 hajny
* better PathExists, fix for too long command line, correction of message
Revision 1.143 2004/09/21 17:25:12 peter
* paraloc branch merged
Revision 1.142 2004/09/16 16:31:53 peter