Android Filing System?
Mike Bonner
bonnmike at gmail.com
Fri Oct 27 07:51:03 EDT 2017
Engine is the virtual/read only part of the file system. Your app will
need to copy your initial data files from there into usable locations. you
can use 'put url' to do this.. (or copy file..)
put url ("binfile:" & specialfolderpath("engine") & "/myfile.dat") into url
("binfile:" & specialfolderpath("documents") & "/myfile.dat")
At this point you can use myfile.dat from its location in the documents
folder.
For organizational purposes of course you'd probably want to create a
folder for your app and place files in there.
You can use "there is a file" to determine if you still need to copy
anything from the engine folder.
if there is a file ("path/to/file") then
-- load it
else
-- copy from engine to the proper location
-- load it
end if
On Fri, Oct 27, 2017 at 5:17 AM, Peter Reid via use-livecode <
use-livecode at lists.runrev.com> wrote:
> Please can someone explain the Android filing system as seen by LC 9. I'm
> developing an app that loads some files & folders with the app initially,
> but then changes some or all of this data. In addition, the app will read
> and write files & folders to the SD card plugged into the Android tablet.
>
> From the LC dictionary, I have the following:
> ---------
> An Android application is installed on the device as a ZIP package.
> This means that any assets that are included are not available as separate
> files in the device's native file system. In order to manage this, LiveCode
> "virtualizes" the asset files you include, allowing read-only access with
> all the standard LiveCode file and folder handling commands and functions.
> To access the assets you have included with your application, use file
> names relative to specialFolderPath("engine").
>
> The following folderIdentifier values are supported:
>
> • "documents": The folder where application-specific data can be
> placed (typically valuable)
> • "cache": The folder where transient application-specific data
> can be placed (typically not valuable)
> • "temporary": Same as "cache"
> • "engine": The (virtual) folder containing the application's
> LiveCode engine and other resources that were copied into the application
> at build time
> • "resources": Same as "engine".
> • "external documents": The folder on the primary shared/external
> storage device where application-specific data can be placed
> • "external cache": The folder on the primary shared/external
> storage device where transient application-specific data can be placed
> • "external temporary": same as "external cache"
>
> Note: If using any external folderIdentifier values, ensure you have the
> 'Write External Storage' permission checked in the application standalone
> settings
> ---------
>
> The above implies that access to the internal filing system is read-only,
> even for the "documents" special folder and that the only filing system
> that I can write to is the external one on the SD card. Is this correct?
>
> I'm trying to carry out the following sequence of actions:
>
> 1. A collection of folders & files are setup in the internal filing system
> as part of the app ("documents" say).
>
> 2. The user can use the default folders & files created above, or they can
> choose a different set of folders & files to be copied from the SD card
> into the internal filing system, replacing some or all of the initial
> default set.
>
> 3. During general use of the app, the user will record their voice several
> times. These recordings should be stored on both the internal and SD card
> filing systems.
>
> What I'm finding is that my file and folder paths are not reliable and
> that most attempts to write anywhere fail due to being read-only.
>
> Any help with this please?
>
> Peter
> --
> Peter Reid
> Loughborough, UK
>
>
> _______________________________________________
> 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