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

Option to append line continuation (\) when adding files to a project

    XMLWordPrintable

Details

    • a420374976a691fee6483c9419e78250a3a30b28 (qt-creator/qt-creator/master)

    Description

      Lists of files in a project file are typically split across multiple lines, one file per line, with each line terminated by a backslash to continue the list. e.g.

      SOURCES += File1.cpp \
          File2.cpp \
          File3.cpp
      
      HEADERS += File1.h \
          File2.h \
          File3.h
      

      If you add files using QtCreator, it maintains this, modifying the last line to add " \", then adding the new file on the next line.

       

      This can cause problems in version control systems when two people add different files to the project. For example:

      1. In some VCSs, such as svn, it can cause merge conflicts because both people have to modify the trailing line.
      2. If the merge is done automatically, it is possible end up with invalid project file, such as:

       

      SOURCES += File1.cpp \
          File2.cpp \
          File3.cpp
      
      HEADERS += File1.h \
          File2.h \
          File3.h \
          File4.h
          File5.h
      

      It's trivial to avoid all these problems, by always adding a trailing slash to the end of the last line when you add the line:

       

       

      SOURCES += File1.cpp \
          File2.cpp \
          File3.cpp \
      
      HEADERS += File1.h \
          File2.h \
          File3.h \
      

      We try to do this, and it makes merging much more straightforward, but it relies on every developer remembering to manually fix-up their project files before committing, and when people forget it's a nuisance.

      It would be helpful if QtCreator had an option to always add a trailing slash when adding files to a .pro file.

       

      Attachments

        Issue Links

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

          Activity

            People

              kandeler Christian Kandeler
              THall Tom Hall
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes