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. Get application folder of current app

Get application folder of current app

Scheduled Pinned Locked Moved Mobile and Embedded
5 Posts 2 Posters 2.2k Views 1 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.
  • D Offline
    D Offline
    dualfaces
    wrote on last edited by
    #1

    Hi,

    i wrote an application for an android device using qt 5.2. In order to copy some library that should be loaded at runtime i need to transfer them from the sdcard to the internal storage.
    Therefore it is proposed to use
    @
    PackageManager pm = context.getPackageManager();
    String dataDir = pm.getApplicationInfo(context.getPackageName(), 0).dataDir;
    @
    But how to achieve using QTAndroidExtras? There is no static function that provides the context. Is there a built in solution for that?

    Thank you!

    Kind Regards

    1 Reply Last reply
    0
    • C Offline
      C Offline
      carlinski
      wrote on last edited by
      #2

      How about loading the library as part of the APK install file? No copying needed then.

      1 Reply Last reply
      0
      • D Offline
        D Offline
        dualfaces
        wrote on last edited by
        #3

        Thanks for your response. Since its determined at runtime which version of the library is used i can't provide it in the apk file. I have to do it at runtime.

        1 Reply Last reply
        0
        • D Offline
          D Offline
          dualfaces
          wrote on last edited by
          #4

          That is what you get for thinking too complicated...
          QDir provides two static functions returning a folder with write permissions for the application:
          @
          QString homePath()
          QDir home()
          @
          Now everything works, i copy the libraries from the sdcard into this directory and load them afterwards.

          Regards

          1 Reply Last reply
          0
          • C Offline
            C Offline
            carlinski
            wrote on last edited by
            #5

            Yes, sometimes you have to take a step back. If it's getting too complicated, maybe you are going about it the wrong way...

            I did it this way:

            @QStandardPaths::writableLocation(QStandardPaths::HomeLocation);@

            1 Reply Last reply
            0

            • Login

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