MG: fixed DirectoryExists

git-svn-id: trunk@376 -
This commit is contained in:
lazarus 2001-10-31 18:09:51 +00:00
parent 2cbcc53a57
commit 07f6e25d94
2 changed files with 11 additions and 1 deletions

View File

@ -44,6 +44,9 @@ end;
function DirectoryExists(DirectoryName: string): boolean; function DirectoryExists(DirectoryName: string): boolean;
var sr: TSearchRec; var sr: TSearchRec;
begin begin
if (DirectoryName<>'')
and (DirectoryName[length(DirectoryName)]=OSDirSeparator) then
DirectoryName:=copy(DirectoryName,1,length(DirectoryName)-1);
if FindFirst(DirectoryName,faAnyFile,sr)=0 then if FindFirst(DirectoryName,faAnyFile,sr)=0 then
Result:=((sr.Attr and faDirectory)>0) Result:=((sr.Attr and faDirectory)>0)
else else

View File

@ -2325,7 +2325,8 @@ writeln('*** TMainIDE.DoOpenEditorFile START "',AFilename,'"');
CheckHeap(IntToStr(GetMem_Cnt)); CheckHeap(IntToStr(GetMem_Cnt));
{$ENDIF} {$ENDIF}
Result:=mrCancel; Result:=mrCancel;
if AFileName='' then exit; if (AFileName='') or (not FileExists(AFilename)) or (DirectoryExists(AFilename))
then exit;
Ext:=lowercase(ExtractFileExt(AFilename)); Ext:=lowercase(ExtractFileExt(AFilename));
// check if the project knows this file // check if the project knows this file
i:=Project.UnitCount-1; i:=Project.UnitCount-1;
@ -4369,6 +4370,9 @@ end.
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.130 2001/10/31 18:09:51 lazarus
MG: fixed DirectoryExists
Revision 1.129 2001/10/31 16:29:20 lazarus Revision 1.129 2001/10/31 16:29:20 lazarus
Fixed the gtk mousemove bug where the control gets the coord's based on it's parent instead of itself. Fixed the gtk mousemove bug where the control gets the coord's based on it's parent instead of itself.
Shane Shane
@ -8981,6 +8985,9 @@ end.
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.130 2001/10/31 18:09:51 lazarus
MG: fixed DirectoryExists
Revision 1.129 2001/10/31 16:29:20 lazarus Revision 1.129 2001/10/31 16:29:20 lazarus
Fixed the gtk mousemove bug where the control gets the coord's based on it's parent instead of itself. Fixed the gtk mousemove bug where the control gets the coord's based on it's parent instead of itself.
Shane Shane