Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. QStandardPaths::GenericDataLocation across different Qt versions (changed between 5.12 and 5.15)
Forum Updated to NodeBB v4.3 + New Features

QStandardPaths::GenericDataLocation across different Qt versions (changed between 5.12 and 5.15)

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
3 Posts 3 Posters 562 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Lucone
    wrote on last edited by
    #1

    Hi there,

    I've developed an Android application using Qt 5.12 which allowed me to store files under QStandardPaths::GenericDataLocation that used to return a path like /storage/emulated/0/Android/data/<package_name>/files.

    I had to update my Qt version to 5.15 due to other factors but the same call to QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) returned just /storage/emulated/0 without any reference to the current package's actual folder.

    Is this intended behavior for the 5.15 version or am I missing something?

    1 Reply Last reply
    0
    • JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote on last edited by
      #2

      Hi, and welcome!

      @Lucone said in QStandardPaths::GenericDataLocation across different Qt versions (changed between 5.12 and 5.15):

      Hi there,

      I've developed an Android application using Qt 5.12 which allowed me to store files under QStandardPaths::GenericDataLocation that used to return a path like /storage/emulated/0/Android/data/<package_name>/files.

      I had to update my Qt version to 5.15 due to other factors but the same call to QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) returned just /storage/emulated/0 without any reference to the current package's actual folder.

      Is this intended behavior for the 5.15 version or am I missing something?

      https://doc.qt.io/qt-5/qstandardpaths.html#StandardLocation-enum says that on Android,

      • GenericDataLocation maps to <USER>
      • DataLocation maps to <APPROOT>/files

      At the same time, the documentation contains a warning that "The paths above should not be relied upon, as they may change according to OS configuration, locale, or they may change in future Qt versions."

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      1 Reply Last reply
      2
      • Paul ColbyP Offline
        Paul ColbyP Offline
        Paul Colby
        wrote on last edited by Paul Colby
        #3

        @Lucone said in QStandardPaths::GenericDataLocation across different Qt versions (changed between 5.12 and 5.15):

        Is this intended behavior for the 5.15 version or am I missing something?

        Yes, sort of. It looks like the change was the result of this commit (specifically, this line), which was to replace the (deprecated) Android function getExternalStorageDirectory() with getExternalFilesDir() instead. The resulting path change is then due to the differences in those two Android functions.

        You might find some of this stackoveflow discussion relevant too: https://stackoverflow.com/questions/10123812/difference-between-getexternalfilesdir-and-getexternalstoragedirectory

        Cheers.

        1 Reply Last reply
        1

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved