* 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; Function PathExists ( F : String) : Boolean;
Var Var
Info : SearchRec; FF : file;
disk : byte; A: word;
I: longint;
begin begin
if F='' then if F = '' then
begin begin
result:=true; PathExists := true;
exit; exit;
end; end;
{ these operating systems have dos type drives } F := FExpand (F);
if source_info.system in [system_m68k_atari,system_i386_go32v2, I := Pos (DriveSeparator, F);
system_i386_win32,system_i386_os2, if (F [Length (F)] = DirectorySeparator)
system_i386_emx,system_i386_wdosx] then and (((I = 0) and (Length (F) > 1)) or (I <> Length (F) - 1))
Begin then
if (Length(f)=3) and (F[2]=':') and (F[3] in ['/','\']) then Delete (F, Length (F), 1);
begin Assign (FF, FExpand (F));
if F[1] in ['A'..'Z'] then GetFAttr (FF, A);
disk:=ord(F[1])-ord('A')+1 PathExists := (DosError = 0) and (A and Directory = Directory);
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);
end; end;
@ -2045,7 +2030,10 @@ implementation
end. end.
{ {
$Log$ $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 * x86_64 fixes
* cleanup of fpcdefs.icn * cleanup of fpcdefs.icn

View File

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

View File

@ -16,7 +16,7 @@ const
general_i_warning=01014; general_i_warning=01014;
general_i_note=01015; general_i_note=01015;
general_i_hint=01016; 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_end_of_file=02000;
scan_f_string_exceeds_line=02001; scan_f_string_exceeds_line=02001;
scan_f_illegal_char=02002; scan_f_illegal_char=02002;
@ -645,7 +645,7 @@ const
option_info=11024; option_info=11024;
option_help_pages=11025; option_help_pages=11025;
MsgTxtSize = 36978; MsgTxtSize = 36977;
MsgIdxMax : array[1..20] of longint=( MsgIdxMax : array[1..20] of longint=(
18,66,209,59,57,46,99,20,35,60, 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; end;
'e' : 'e' :
exepath:=FixPath(FExpand(More),true); exepath:=FixPath(More,true);
'E' : 'E' :
begin begin
@ -667,11 +667,11 @@ begin
initsourcecodepage:=more; initsourcecodepage:=more;
end; end;
'D' : 'D' :
utilsdirectory:=FixPath(FExpand(More),true); utilsdirectory:=FixPath(More,true);
'e' : 'e' :
SetRedirectFile(More); SetRedirectFile(More);
'E' : 'E' :
OutputExeDir:=FixPath(FExpand(More),true); OutputExeDir:=FixPath(More,true);
'i' : 'i' :
begin begin
if ispara then if ispara then
@ -712,7 +712,7 @@ begin
unitsearchpath.AddPath(More,true); unitsearchpath.AddPath(More,true);
end; end;
'U' : 'U' :
OutputUnitDir:=FixPath(FExpand(More),true); OutputUnitDir:=FixPath(More,true);
else else
IllegalPara(opt); IllegalPara(opt);
end; end;
@ -1698,6 +1698,7 @@ begin
def_symbol('HASOUT'); def_symbol('HASOUT');
def_symbol('HASGLOBALPROPERTY'); def_symbol('HASGLOBALPROPERTY');
def_symbol('FPC_HASPREFETCH'); def_symbol('FPC_HASPREFETCH');
def_symbol('FPC_LINEEND_IN_TEXTREC');
{$ifdef i386} {$ifdef i386}
def_symbol('HASINTF'); def_symbol('HASINTF');
def_symbol('HASVARIANT'); def_symbol('HASVARIANT');
@ -1949,7 +1950,7 @@ begin
if (OutputExeDir<>'') and if (OutputExeDir<>'') and
not PathExists(OutputExeDir) then not PathExists(OutputExeDir) then
begin begin
Message1(general_e_path_does_not_exists,OutputExeDir); Message1(general_e_path_does_not_exist,OutputExeDir);
StopOptions(1); StopOptions(1);
end; end;
@ -2089,7 +2090,10 @@ finalization
end. end.
{ {
$Log$ $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 * paraloc branch merged
Revision 1.142 2004/09/16 16:31:53 peter Revision 1.142 2004/09/16 16:31:53 peter