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

CompilationDatabaseProjectManager: Incorrect folder structure when multiple directories with same name exist

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Not Evaluated
    • Resolution: Done
    • Affects Version/s: Qt Creator 4.9.0-beta1
    • Fix Version/s: Qt Creator 4.9.0-beta1
    • Labels:
      None
    • Environment:
      Debian testing, Plasma desktop
    • Platform/s:
      Linux/X11
    • Commits:
      92f1dba285d15cdee5e70b4fa8c5673fa52f1613 (qt-creator/qt-creator/master)

      Description

      The CompilationDatabaseProjectManager plugin does not correctly build up the directory hierarchy when multiple directories with the same name exist within the project's directory hierarchy. I have created a small sample project to demonstrate this:

      Steps to reproduce:

      1) enable the experimental CompilationDatabaseProjectManager plugin
      2) save the attached tar archive `testproject.tar.gz` in the `/tmp/` directory
      3) `cd /tmp/`
      4) extract the tar archive: `tar -xavf testproject.tar.gz`
      5) load the test project into Qt Creator (right click in "Projects" view -> "Load Project" -> select File `/tmp/testproject/compile_commands.json`)
      6) observe the directory structure in the project view

      Result:

      The directory structure is displayed incorrectly. There is no top-level `vcl` directory, but the `vcl/qt5/second.cxx` tree is shown underneath `canvas/source`.

      The attached screenshot `screenshot_incorrect_directory_structure.png` shows this.

      Expected result:

      The original file tree hierarchy should be represented in the project view.

      There should be a top-level `vcl` directory containing a `qt5` subdirectory, which in turn contains the file `second.cxx`, besides `canvas/source/vcl/first.cxx`.

      Note: Instead of extracting the test project into `/tmp/`, any other directory can be chosen as well. However, the compilation database `compile_commands.json` needs to be recreated in this case (e.g. by running `bear make`), since it contains absolute path names.

        Attachments

        1. screenshot_incorrect_directory_structure.png
          26 kB
          Michael Weghorn
        2. testproject.tar.gz
          0.6 kB
          Michael Weghorn
        For Gerrit Dashboard: QTCREATORBUG-21725
        # Subject Branch Project Status CR V

          Activity

            People

            Assignee:
            yvvan Ivan Donchevskii
            Reporter:
            michaelweghorn Michael Weghorn
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes