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

QDesktopServices::storageLocation(QDesktopServices::DataLocation) return invalid path string in Linux if organisation name or application name is not set

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • None
    • 4.6.2
    • Core: Other
    • None

    Description

      QDesktopServices::storageLocation(QDesktopServices::DataLocation) return invalid path string in Linux if organizationName and/or applicationName is not set.

      file: qdesktopservices_x11.cpp:

        if (type == QDesktopServices::DataLocation) {
              QString xdgDataHome = QLatin1String(qgetenv("XDG_DATA_HOME"));
              if (xdgDataHome.isEmpty())
                  xdgDataHome = QDir::homePath() + QLatin1String("/.local/share");
              xdgDataHome += QLatin1String("/data/")
                          + QCoreApplication::organizationName() + QLatin1Char('/')
                          + QCoreApplication::applicationName();
              return xdgDataHome;
          }
      

      We can see from code that if organisation name is empty there will be double '/'-chars after 'data'. If application name is missing then function will return string which end with '/'. So it doesn't behave same way with and without application name. If organisation AND application name is missing the function will return path which ends with double '/'-character.

      Attachments

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

        Activity

          People

            sorvig Morten Sørvig
            appoyhon Antti Pöyhönen (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes