Page 1 of 1

specialFolderPath("documents") can't see my DB

Posted: Sun Mar 06, 2016 2:35 pm
by francof
Hi all,
my app uses a db stored in specialFolderPath documents:

Code: Select all

 if the environment is "mobile" then
      put specialFolderPath("engine") & "/Gradazione-Babo.sqlite"        into engineFilePath     --answer " Mobile Environment is -->  " & the environment
      put specialFolderPath("documents") & "/Gradazione-Babo.sqlite"  into tDatabasePath
      
      if there is not a file tDatabasePath then                                                                                   --- if database is already in the documents folder. If not, copy it from the engine folder
         put URL ("binfile:" & engineFilePath)  into URL("binfile:" & tDatabasePath )
         answer " File is copied from Engine into the Documents folder ..."
         answer "tDatabasePath contiene: "& tDatabasePath
      else
         answer "File is already in the documents folder ... "
      end if
   end if
and I have access to it, no problem.

but I can't see the db stored in documents folder. when I browse to that path it is empty. the same through the PC connection with the phone: the folder documents is empty.
I've checked "write external storage" on standalone appl. settings.

any idea?
thanks for help
franco

Re: specialFolderPath("documents") can't see my DB

Posted: Sun Mar 06, 2016 4:09 pm
by SparkOut
This is probably a sandboxing/security issue. ONLY the parent app has access to the documents folder under the app folder hierarchy (unless you have some fancy software and/or the phone is rooted). If you can read and write the db file under specialFolderPath("documents") from the LC app then that will be all that is expected. If you want to view the db file or access it via another app, you will have to use a publicly writeable filepath.

MaxV has provided a lot of insight to the folder/path structures on Android, for example : http://forums.livecode.com/viewtopic.ph ... 15#p127466

Re: specialFolderPath("documents") can't see my DB

Posted: Mon Mar 07, 2016 5:01 pm
by francof
Hi SparkOut,
SparkOut wrote:...ONLY the parent app has access to the documents folder under the app folder hierarchy...
I imagined this, I have decided to store my db into the card (mnt/sdcard...)

franco