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. copying file back to assets folder in android
Forum Updated to NodeBB v4.3 + New Features

copying file back to assets folder in android

Scheduled Pinned Locked Moved Solved Mobile and Embedded
4 Posts 3 Posters 1.5k 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
    divaindie
    wrote on last edited by
    #1

    my android application is having one default database file in asset-folder.whenever i open my android app ,i will copy this database file to a writable location (iam using QFile.copy() for copying file and QStandardpath to identify writable location) .then iam making some changes to this database file.at the end whenever i close the android app i must copy back this database file (i hope this is the right way to do)to assets folder.this is where iam failing,for some reason iam not able to copy back database file back to assets folder in android.(iam using Qfile.copy() api).Qfile.copy() will fail if the file which iam copying is already exists in the destination location, so i tried deleting the database file in asset folder but there also it is failing.then i thought this might be becauase of permission issue then i tried changing the permission of database file (for this i had used QFile::setPermissions) in asset folder but there also iam failing.
    is it because of asset folder ? how one can change file permission which are in asset folder ?is it possible to copy/remove files which are in asset folder?
    what way i can solve this problem? please let me know!!

    jsulmJ 1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      AFAIK, the assets are read-only resources so you can't copy back to it.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • D divaindie

        my android application is having one default database file in asset-folder.whenever i open my android app ,i will copy this database file to a writable location (iam using QFile.copy() for copying file and QStandardpath to identify writable location) .then iam making some changes to this database file.at the end whenever i close the android app i must copy back this database file (i hope this is the right way to do)to assets folder.this is where iam failing,for some reason iam not able to copy back database file back to assets folder in android.(iam using Qfile.copy() api).Qfile.copy() will fail if the file which iam copying is already exists in the destination location, so i tried deleting the database file in asset folder but there also it is failing.then i thought this might be becauase of permission issue then i tried changing the permission of database file (for this i had used QFile::setPermissions) in asset folder but there also iam failing.
        is it because of asset folder ? how one can change file permission which are in asset folder ?is it possible to copy/remove files which are in asset folder?
        what way i can solve this problem? please let me know!!

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #3

        @divaindie Why do you want to copy the db back to assets folder?

        https://forum.qt.io/topic/113070/qt-code-of-conduct

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

          @SGaist said in copying file back to assets folder in android:

          Hi all ,thanks for your answers.yesterday i found out that there is no need to copy back database file to asset folder.earlier i assumed that if i unninstall the app "appdatalocation-folder" still exists on android file system,but the truth is that this location is deleted whenever i uninstall the app.so i do not need to copy back db file to assets folder !!!
          thanks!!

          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