cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Grieve (JIRA)" <>
Subject [jira] [Commented] (CB-285) Add property returning root path of PhoneGap files
Date Wed, 06 Feb 2013 05:01:15 GMT


Andrew Grieve commented on CB-285:

Yes. Definitely want to allow users to chose make the decision of where their files go. Android
has no iCloud equivalent, but instead has a shared file-system for things like music &

So, here's another proposal: Instead of adding non-standard constants to requestFileSystem(),
we add a new (non-standard) API:

// gets a (read-only) DirectoryEntry for the www directory.

  sandboxed: true || false,
  persistence: 'temporary' || 'cache' || 'device_persistent' || 'persistent',
  category: 'data' || 'documents'
}, success);

sandboxed: will be ignored for iOS. For Android it will toggle between external an internal
- Defaults to true.
- If non-sandboxed is unavailable (iOS), fall-back to true.

- on Android, 'temporary' == 'cache', but on iOS they are different.
- on Android, 'device_persistent' == 'persistent', but on iOS one has iCloud enabled and the
other does not.

- Defaults to 'data'
- persistence == 'temporary' or 'cache' ==> this value is ignored.
- Android && sandboxed == true ==> files/ directory
- 'data' && iOS && persistence == 'persistent' ==> <Application_Home>/Library
- 'data' && iOS && persistence == 'device_persistent' ==> <Application_Home>/Library/NoCloud
(and we set the extended attr on this directory to make it unsynced.
- 'data' && Android ==> files/ subdirectory of app storage (based on sandboxed
- 'documents' && iOS && persistence == 'persistent' ==> <Application_Home>/Documents
- 'documents' && iOS && persistence == 'device_persistent' ==> <Application_Home>/Documents/NoCloud
- 'documents' && Android ==> /sdcard

> Add property returning root path of PhoneGap files
> --------------------------------------------------
>                 Key: CB-285
>                 URL:
>             Project: Apache Cordova
>          Issue Type: Improvement
>          Components: CordovaJS
>    Affects Versions: 1.4.0
>         Environment: Both PhoneGap SDK and PhoneGap Build
>            Reporter: Ashley Gullen
>            Assignee: Andrew Grieve
>              Labels: features
> There needs to be a property in PhoneGap that returns the root path to the general files
added to the PhoneGap project (i.e. the directory index.html is in).  For example, if I add
'music.mp3' to my project, in Android it will be located in:
> /android_asset/www/music.mp3
> On iOS after being built with PhoneGap Build it will be located in some path like this:
> /var/mobile/Applications/<app_ID>/<name>.app/www/music.mp3
> However, there does not appear to be a programmatic way to determine both <app_ID>
and <name>.app.
> This has two side effects:
> 1. Paths to audio for Media must be hard-coded separately depending on the platform,
which is inconvenient.
> 2. Paths to audio for Media cannot be known if developing a framework that uses PhoneGap.
 Since a framework does not know the App ID or name in advance, it's impossible for the framework
to determine the correct path.
> This is actively blocking audio from working on iOS in PhoneGap projects exported by
Construct 2 (, a HTML5 game creator.  Also, it seems like kind of an important
function to make available anyway, since hard-coding paths for each platform is a pain.
> This PhoneGap Support thread led to this issue:

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

View raw message