Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [cdt-dev] Add Include broken ?

Looks like a defect to me. I don’t think Add Include has been looked at in a while. Feel free to propose a patch as well.


Cheers,

Doug

 


From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Janees Elamkulam
Sent: Monday, October 24, 2005 2:23 AM
To: CDT General developers list.
Subject: [cdt-dev] Add Include broken ?

 


Hi,

I have two classes say 'Class1' and 'Class2' in a Project. (TestProject),  now add a member variable 'var1' of type 'Class1'in Class2.  Now add header file for Class1 using context menu (Right Click on Class1 -> Add Include). the result is #include "/TestProject/Class1.h"
Shouldn't it be  #include "Class1.h" or atleast  #include "TestProject/Class1.h" ?

A quick look on this, I found that  "AddIncludeOnSelectionAction::getRequiredInclude" and "PathUtil::makeRelativePathToProjectIncludes" expects path in full and not related to the project as root , returned by "AddIncludeOnSelectionAction::findTypeInfos". This relative path is making the following code snippet in AddIncludeOnSelectionAction::getRequiredInclude  to fail

           if (includePath != null && !projectLocation.isPrefixOf(typeLocation)) {
                isSystemIncludePath = true;
            } else if (projectLocation.isPrefixOf(typeLocation)
                    && projectLocation.isPrefixOf(headerLocation)) {
                includePath = PathUtil.makeRelativePath(typeLocation, headerLocation.removeLastSegments(1));
            }
           if (includePath == null)
                includePath = typeLocation;

Is this a defect ? or am i doing some thing wrong ?


Thanks,

- Janees


Back to the top