From 0bfff4fa0375941e85d3ab46c94c54fea5f1e1b9 Mon Sep 17 00:00:00 2001 From: mattias Date: Sat, 24 Jul 2010 14:51:47 +0000 Subject: [PATCH] IDE: add to project: add relative unit path, bug #17021 git-svn-id: trunk@26811 - --- ide/main.pp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ide/main.pp b/ide/main.pp index 7105b39fa4..11405368c1 100644 --- a/ide/main.pp +++ b/ide/main.pp @@ -15961,6 +15961,7 @@ var Owners: TFPList; i: Integer; APackage: TLazPackage; + ShortDir: String; begin DependencyAdded:=false; if UnitInfo.IsVirtual then exit; @@ -15991,14 +15992,16 @@ begin end; end; // unit is not in a package => extend unit path + ShortDir:=CurDirectory; + if (not Project1.IsVirtual) then + ShortDir:=CreateRelativePath(ShortDir,Project1.ProjectDirectory); if MessageDlg(lisAddToUnitSearchPath, Format(lisTheNewUnitIsNotYetInTheUnitSearchPathAddDirectory, [ #13, CurDirectory]), mtConfirmation,[mbYes,mbNo],0)=mrYes then begin Project1.CompilerOptions.OtherUnitFiles:= - MergeSearchPaths(Project1.CompilerOptions.OtherUnitFiles, - CurDirectory); + MergeSearchPaths(Project1.CompilerOptions.OtherUnitFiles,ShortDir); end; end; end; @@ -16013,9 +16016,11 @@ var DependencyAdded: boolean; begin Result:=mrOk; + //debugln(['TMainIDE.ProjInspectorAddUnitToProject ',AnUnitInfo.Filename]); BeginCodeTool(ActiveSourceEditor,ActiveUnitInfo,[]); AnUnitInfo.IsPartOfProject:=true; - CheckUnitDirIsInSearchPath(AnUnitInfo,false,DependencyAdded); + if FilenameIsPascalUnit(AnUnitInfo.Filename) then + CheckUnitDirIsInSearchPath(AnUnitInfo,false,DependencyAdded); if FilenameIsPascalUnit(AnUnitInfo.Filename) and (pfMainUnitHasUsesSectionForAllUnits in Project1.Flags) then begin