mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-07 12:44:00 +02:00
MG: fixed open file at cursor search path
git-svn-id: trunk@1753 -
This commit is contained in:
parent
81cc26790e
commit
48c4518d3c
66
ide/main.pp
66
ide/main.pp
@ -3861,42 +3861,55 @@ var ActiveSrcEdit: TSourceEditor;
|
|||||||
// Searches for FName in SPath
|
// Searches for FName in SPath
|
||||||
// If FName is not found, we'll check extensions pp and pas too
|
// If FName is not found, we'll check extensions pp and pas too
|
||||||
// Returns true if found. FName contains the full file+path in that case
|
// Returns true if found. FName contains the full file+path in that case
|
||||||
var TempFile,TempPath,CurPath,Ext: String;
|
var TempFile,TempPath,CurPath,FinalFile, Ext: String;
|
||||||
i,p,c: Integer;
|
i,p,c: Integer;
|
||||||
begin
|
begin
|
||||||
if SPath='' then SPath:='.';
|
if SPath='' then SPath:='.';
|
||||||
Result:=true;
|
Result:=true;
|
||||||
for i:=0 to 2 do begin
|
TempPath:=SPath;
|
||||||
case i of
|
while TempPath<>'' do begin
|
||||||
1: Ext:='.pp';
|
p:=pos(';',TempPath);
|
||||||
2: Ext:='.pas';
|
if p=0 then p:=length(TempPath)+1;
|
||||||
else Ext:='';
|
CurPath:=copy(TempPath,1,p-1);
|
||||||
|
Delete(TempPath,1,p);
|
||||||
|
if CurPath='' then continue;
|
||||||
|
CurPath:=AppendPathDelim(CurPath);
|
||||||
|
if not FilenameIsAbsolute(CurPath) then begin
|
||||||
|
if ActiveUnitInfo.IsVirtual then
|
||||||
|
CurPath:=AppendPathDelim(Project1.ProjectDirectory)+CurPath
|
||||||
|
else
|
||||||
|
CurPath:=AppendPathDelim(ExtractFilePath(ActiveUnitInfo.Filename))
|
||||||
|
+CurPath;
|
||||||
end;
|
end;
|
||||||
TempPath:=SPath;
|
for c:=0 to 2 do begin
|
||||||
while TempPath<>'' do begin
|
case c of
|
||||||
p:=pos(';',TempPath);
|
0: TempFile:=FName;
|
||||||
if p=0 then p:=length(TempPath)+1;
|
1: TempFile:=LowerCase(FName);
|
||||||
CurPath:=copy(TempPath,1,p-1);
|
2: TempFile:=UpperCase(FName);
|
||||||
Delete(TempPath,1,p);
|
end;
|
||||||
if CurPath='' then continue;
|
if ExtractFileExt(TempFile)='' then begin
|
||||||
if CurPath[length(CurPath)]<>PathDelim then
|
for i:=0 to 2 do begin
|
||||||
CurPath:=CurPath+PathDelim;
|
case i of
|
||||||
for c:=0 to 2 do begin
|
1: Ext:='.pp';
|
||||||
case c of
|
2: Ext:='.pas';
|
||||||
0: TempFile:=FName;
|
else Ext:='';
|
||||||
1: TempFile:=LowerCase(FName);
|
end;
|
||||||
2: TempFile:=UpperCase(FName);
|
FinalFile:=ExpandFileName(CurPath+TempFile+Ext);
|
||||||
|
if FileExists(FinalFile) then begin
|
||||||
|
FName:=FinalFile;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
TempFile:=ExpandFileName(CurPath+TempFile+Ext);
|
end else begin
|
||||||
if FileExists(TempFile) then begin
|
FinalFile:=ExpandFileName(CurPath+TempFile);
|
||||||
FName:=TempFile;
|
if FileExists(FinalFile) then begin
|
||||||
|
FName:=FinalFile;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
if (Ext='') and (ExtractFileExt(FName)<>'') then break;
|
|
||||||
end;
|
end;
|
||||||
result:=false;
|
Result:=false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function GetFilenameAtRowCol(XY: TPoint): string;
|
function GetFilenameAtRowCol(XY: TPoint): string;
|
||||||
@ -6488,6 +6501,9 @@ end.
|
|||||||
|
|
||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.313 2002/06/14 14:57:05 lazarus
|
||||||
|
MG: fixed open file at cursor search path
|
||||||
|
|
||||||
Revision 1.312 2002/06/13 18:37:47 lazarus
|
Revision 1.312 2002/06/13 18:37:47 lazarus
|
||||||
MG: added upper/lowercase selection
|
MG: added upper/lowercase selection
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user