Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-22338

Compilation Database can misinterpret relative include paths

    XMLWordPrintable

Details

    • All
    • 443d8e4713d4c0a2d4d8a8dc0341910500c943b5 (qt-creator/qt-creator/master)

    Description

      The include path processing for the Compilation Database plugin includes the following code:

      if (!QDir(pathStr).exists()
              && QDir(workingDir + "/" + pathStr).exists()) {
          result = workingDir + "/" + pathStr;
      }
      

      The project I'm currently working with includes an include path (among others) of -I../.., which obviously exists almost anywhere in the file system, and thus the if block is skipped. This is wrong, however, as the path should definitely be interpreted relative to the working directory (which seems like it would always be the case for relative paths).

      Is there any reason not to do something like this, instead?

      if (!QDir(pathStr).isAbsolute()) {
          result = workingDir + "/" + pathStr;
      }
      

      It seems to work for me, but I don't know the reasoning behind the initial version.

      Attachments

        For Gerrit Dashboard: QTCREATORBUG-22338
        # Subject Branch Project Status CR V

        Activity

          People

            yvvan Ivan Donchevskii
            erikjensen Erik Jensen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes