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

The place to discuss anything and everything about running your LiveCode on Android

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
francof
Posts: 237
Joined: Fri Apr 11, 2014 10:51 am

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

Post by francof » Sun Mar 06, 2016 2:35 pm

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

SparkOut
Posts: 2947
Joined: Sun Sep 23, 2007 4:58 pm

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

Post by SparkOut » Sun Mar 06, 2016 4:09 pm

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

francof
Posts: 237
Joined: Fri Apr 11, 2014 10:51 am

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

Post by francof » Mon Mar 07, 2016 5:01 pm

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

Post Reply