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

QStandardPaths does not append applicationName for writableLocation with ConfigLocation

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.5.0
    • 5.2.1
    • Core: I/O
    • None
    • Unix
    • 4c980aedc17c1da8f7160989fbb845ea72b36f44

    Description

      When doing QStandardPaths::writableLocation(...) with CacheLocation or DataLocation, Qt properly appends applicationName if we didn't pass a Generic(Cache|Data)Location argument.

      However with ConfigLocation, the same path gets returned with ConfigLocation and GenericLocation. From qt5/qtbase/src/corelib/io/qstandardpaths_unix.cpp:

          case DataLocation:
          case GenericDataLocation:
          {
              QString xdgDataHome = QFile::decodeName(qgetenv("XDG_DATA_HOME"));
              if (isTestModeEnabled())
                  xdgDataHome = QDir::homePath() + QLatin1String("/.qttest/share");
              if (xdgDataHome.isEmpty())
                  xdgDataHome = QDir::homePath() + QLatin1String("/.local/share");
              if (type == QStandardPaths::DataLocation)
                  appendOrganizationAndApp(xdgDataHome);
              return xdgDataHome;
          }
          case ConfigLocation:
          case GenericConfigLocation:
          {
              // http://standards.freedesktop.org/basedir-spec/latest/
              QString xdgConfigHome = QFile::decodeName(qgetenv("XDG_CONFIG_HOME"));
              if (isTestModeEnabled())
                  xdgConfigHome = QDir::homePath() + QLatin1String("/.qttest/config");
              if (xdgConfigHome.isEmpty())
                  xdgConfigHome = QDir::homePath() + QLatin1String("/.config");
              return xdgConfigHome;
          }
      

      As you can see, appendOrganizationAndApp(xdgConfigHome) is missing in that case.

      In Windows this works correctly, so this is inconsistent with that too.

      Attachments

        For Gerrit Dashboard: QTBUG-38872
        # Subject Branch Project Status CR V

        Activity

          People

            dfaure David Faure (Private)
            the compiler Florian Bruhin
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes