Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-75199

qdbusxml2cpp does not properly handle Windows output file paths

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • Not Evaluated
    • None
    • 5.12.2
    • D-Bus
    • None
    • Windows

    Description

      The help text of the tool claims:

      You can also use a colon ( : ) to separate the header name from the source file name, as in '-a filename_p.h:filename.cpp'

      If an absolute path is given for the output header and source files on Windows, the tool does not generate the header file.

      Specifically, because Windows paths usually contain a colon ( C:\foo\bar.h ), the tool splits the command line argument on the first colon, and incorrectly assumes which are the file paths.

      Relevant code piece.

      // produce a header name from the file name
      static QString header(const QString &name)
      {
          QStringList parts = name.split(QLatin1Char(':'));
          QString retval = parts.first();
      
          if (retval.isEmpty() || retval == QLatin1String("-"))
              return retval;
      
          if (!retval.endsWith(QLatin1String(".h")) && !retval.endsWith(QLatin1String(".cpp")) &&
              !retval.endsWith(QLatin1String(".cc")))
              retval.append(QLatin1String(".h"));
      
          return retval;
      }
      

      Not sure if we should / could replace the colon with something else (a semicolon perhaps), or we should try to handle windows paths with some heuristics.

      This was uncovered as part of the Qt CMake port.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            thiago Thiago Macieira
            alexandru.croitor Alexandru Croitor
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes