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

QStandardPaths does not append applicationName for writableLocation with ConfigLocation

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3: Somewhat important
    • Resolution: Done
    • Affects Version/s: 5.2.1
    • Fix Version/s: 5.5.0
    • Component/s: Core: I/O
    • Labels:
      None
    • Environment:
      Unix
    • Commits:
      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

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

          Activity

            People

            • Assignee:
              dfaure David Faure (Private)
              Reporter:
              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