mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-11 18:00:37 +01:00
IDE: add to project: add relative unit path, bug #17021
git-svn-id: trunk@26811 -
This commit is contained in:
parent
4fcf37a14d
commit
0bfff4fa03
11
ide/main.pp
11
ide/main.pp
@ -15961,6 +15961,7 @@ var
|
|||||||
Owners: TFPList;
|
Owners: TFPList;
|
||||||
i: Integer;
|
i: Integer;
|
||||||
APackage: TLazPackage;
|
APackage: TLazPackage;
|
||||||
|
ShortDir: String;
|
||||||
begin
|
begin
|
||||||
DependencyAdded:=false;
|
DependencyAdded:=false;
|
||||||
if UnitInfo.IsVirtual then exit;
|
if UnitInfo.IsVirtual then exit;
|
||||||
@ -15991,14 +15992,16 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
// unit is not in a package => extend unit path
|
// unit is not in a package => extend unit path
|
||||||
|
ShortDir:=CurDirectory;
|
||||||
|
if (not Project1.IsVirtual) then
|
||||||
|
ShortDir:=CreateRelativePath(ShortDir,Project1.ProjectDirectory);
|
||||||
if MessageDlg(lisAddToUnitSearchPath,
|
if MessageDlg(lisAddToUnitSearchPath,
|
||||||
Format(lisTheNewUnitIsNotYetInTheUnitSearchPathAddDirectory, [
|
Format(lisTheNewUnitIsNotYetInTheUnitSearchPathAddDirectory, [
|
||||||
#13, CurDirectory]),
|
#13, CurDirectory]),
|
||||||
mtConfirmation,[mbYes,mbNo],0)=mrYes
|
mtConfirmation,[mbYes,mbNo],0)=mrYes
|
||||||
then begin
|
then begin
|
||||||
Project1.CompilerOptions.OtherUnitFiles:=
|
Project1.CompilerOptions.OtherUnitFiles:=
|
||||||
MergeSearchPaths(Project1.CompilerOptions.OtherUnitFiles,
|
MergeSearchPaths(Project1.CompilerOptions.OtherUnitFiles,ShortDir);
|
||||||
CurDirectory);
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -16013,9 +16016,11 @@ var
|
|||||||
DependencyAdded: boolean;
|
DependencyAdded: boolean;
|
||||||
begin
|
begin
|
||||||
Result:=mrOk;
|
Result:=mrOk;
|
||||||
|
//debugln(['TMainIDE.ProjInspectorAddUnitToProject ',AnUnitInfo.Filename]);
|
||||||
BeginCodeTool(ActiveSourceEditor,ActiveUnitInfo,[]);
|
BeginCodeTool(ActiveSourceEditor,ActiveUnitInfo,[]);
|
||||||
AnUnitInfo.IsPartOfProject:=true;
|
AnUnitInfo.IsPartOfProject:=true;
|
||||||
CheckUnitDirIsInSearchPath(AnUnitInfo,false,DependencyAdded);
|
if FilenameIsPascalUnit(AnUnitInfo.Filename) then
|
||||||
|
CheckUnitDirIsInSearchPath(AnUnitInfo,false,DependencyAdded);
|
||||||
if FilenameIsPascalUnit(AnUnitInfo.Filename)
|
if FilenameIsPascalUnit(AnUnitInfo.Filename)
|
||||||
and (pfMainUnitHasUsesSectionForAllUnits in Project1.Flags)
|
and (pfMainUnitHasUsesSectionForAllUnits in Project1.Flags)
|
||||||
then begin
|
then begin
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user