This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 92697 - Parser Settings are wrong on Windows in specific case
Summary: Parser Settings are wrong on Windows in specific case
Status: RESOLVED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 5.x
Hardware: PC Windows XP
: P2 blocker (vote)
Assignee: Thomas Preisler
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-01-17 13:39 UTC by Maria Tishkova
Modified: 2007-09-11 07:11 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Maria Tishkova 2007-01-17 13:39:49 UTC
If user has netbeans installed on disk D:
and he/she has folder D:/usr (actually "usr" folder at the same disk netbeans is
installed) Parser Settings for C/C++ compilers are wrong: paths are started with
/usr and all system header files are unresolved for all C/C++ projects.



org.netbeans.modules.cnd.makeproject.api.compilers.GNUCCompiler and
org.netbeans.modules.cnd.makeproject.api.compilers.GNUCCCompiler 
use the following code:
   if (platform.getId() == Platform.PLATFORM_WINDOWS) {
            if (new File("/usr/").exists())  // NOI18N
                includePrefix = ""; // NOI18N
            else if (new File("C:/cygwin").exists())  // NOI18N
                includePrefix = "C:/cygwin"; // NOI18N
            else if (new File("D:/cygwin").exists())  // NOI18N
                includePrefix = "D:/cygwin"; // NOI18N
            else if (new File("E:/cygwin").exists())  // NOI18N
                includePrefix = "E:/cygwin"; // NOI18N
            else if (new File("F:/cygwin").exists())  // NOI18N
                includePrefix = "F:/cygwin"; // NOI18N
        }

the value of  new File("/usr/").exists() is true in this particular case (you
run java from the same disk usr folder created at).

you can check with the simple test case that new File("/usr/").exists() will
return true, but new File("/usr/").getCanonicalPath() will return "D:\usr"

P.S. I have spend a half of day trying to understand what is wrong with  my
laptop and I had to debug C/C++ Dev Pack to understand the problem, I am not
sure our users will spend so much time trying to make it work, that's why I have
set priority to P2. The second reason I have set priority to P2 is the algorithm
used to convert system include paths doesn't look correct and will be failed if
we have non standard Cygwin installation for example.
Comment 1 _ gordonp 2007-04-04 15:31:23 UTC
Is this a new problem? The code you showed is not new code (ie, its been in
makeproject since cnd 5.5 and isn't related to my recent commits). Anyway,
I'll either fix it or hand off to Thomas.

I've actually been considering doing a lookup in the Windows registry to
find the default Cygwin install location. Perhaps now is the time to do that.
Comment 2 Thomas Preisler 2007-09-11 07:11:46 UTC
Fixed. Now using path from actual compiler.

I'm not sure why the code used to check for /usr. I don't think it is necessary.