iPad File structure question

Ralph DiMola rdimola at evergreeninfo.net
Thu Oct 15 14:27:38 EDT 2015


First of all I created a function theEngine. This will allow testing in the
IDE.

function TheEngine
   local tStackPath
switch 
 case the environment = "Mobile"
 return the engine folder
 break
default
  put the long name of this stack into tStackPath
   replace ("stack "&quote) with empty in tStackPath
   put char 1 to -2 in tStackPath into tStackPath
   set the itemdelimiter to slash
   put item 1 to -2 of tStackPath into tStackPath         
 return tStackPath
end switch
   
end TheEngine

Then a function to get destination document paths

Function TheDocuments
local tStackPath
switch 
 case the environment = "Mobile"
 return the documents folder
 break
default
put the long name of this stack into tStackPath
   replace ("stack "&quote) with empty in tStackPath
   put char 1 to -2 in tStackPath into tStackPath
   set the itemdelimiter to slash
   put item 1 to -2 of tStackPath into tStackPath         
 return tStackPath & slash & "MyTestFolder"
end switch
End TheDocuments

MyTestFolder is a folder in the stack folder that will mirror what will be
in the documents folder on mobile.

Then copy the file...

put url ("binfile:"&TheEngine()slash&"Mydb.db") into url
("binfile:"&TheDocuments())

set the no-backup for iOS....
if the platform = "iphone" then
iphoneSetDoNotBackupFile TheDocuments()slash&"Mydb.db" , true
end if

When opening the DB use this as the filename parameter==>
TheDocuments()slash&"Mydb.db"
This will work in the IDE or Mobile.

Disclaimer. I excised this code and there could be a typo But this should
get you going.

Ralph DiMola
IT Director
Evergreen Information Services
rdimola at evergreeninfo.net


-----Original Message-----
From: use-livecode [mailto:use-livecode-bounces at lists.runrev.com] On Behalf
Of Glen Bojsza
Sent: Thursday, October 15, 2015 12:58 PM
To: How to use LiveCode
Subject: Re: iPad File structure question

This must be how a lot of the other apps are doing it since I have seen
their SQLite files in their app contents.

I am only doing read only and was hoping that this be fine but your
suggestions are well taken.

What is the syntax for copying the file from the engine's folder?

Also any idea why I can't select Script Libraries for database and Database
Support for SQLite?


Glen


On Thu, Oct 15, 2015 at 12:31 PM, Ralph DiMola <rdimola at evergreeninfo.net>
wrote:

> Mobile app's files specified in the "copy files" pane of the 
> standalone settings are accessed via "the engine folder" path. You 
> can't open SQLite DBs in "the engine folder" because "the engine 
> folder" is read-only. There is no facility to open a SQLite db 
> read-only. Option 1:Copy the db from "the engine folder" to "the 
> documents folder" and open it there. On iOS make sure you mark any 
> large files in the documents folder as "no backup" to make it through 
> the review process. Option 2: Copy the db from "the engine folder"
> to "specialFolderPath("cache")" and open it there. The user can clear 
> the cache so check at each startup to make sure the db is still in the 
> "specialFolderPath("cache")" folder. There is no size 
> limitation(within
> reason) for the cache on iOS as it is not backed up to the cloud.
>
> Ralph DiMola
> IT Director
> Evergreen Information Services
> rdimola at evergreeninfo.net
>
>
_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list