incubator-callback-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Filip Maj (Issue Comment Edited) (JIRA)" <j...@apache.org>
Subject [jira] [Issue Comment Edited] (CB-285) Add property returning root path of PhoneGap files
Date Wed, 29 Feb 2012 17:01:58 GMT

    [ https://issues.apache.org/jira/browse/CB-285?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13219342#comment-13219342
] 

Filip Maj edited comment on CB-285 at 2/29/12 5:00 PM:
-------------------------------------------------------

I agree this is an important feature, but I think we need to carefully frame the problem.

What exactly do you mean by "root"? Root of the application location, or root of the device
file system? Why exactly do you need the "root" location? My point is, are you simply looking
for a permanent / persistent location on the device to write and read files from, for use
with your app? If so, then we have an existing method ([window.requestFileSystem and the LocalFileSystem|http://docs.phonegap.com/en/1.4.1/phonegap_file_file.md.html#LocalFileSystem])
that can get you both a temporary and a persistent file system location independent of your
device. 

The trickiness with asking for "root" is the differing security constraints across all of
the Cordova platforms.

My opinion is, if you are looking for a "safe" location to read and write files to in a cross-platform
way, I would use the requestFileSystem method and work from there. If there are issues with
using this method, then we should figure those out, instead of adding a new property somewhere
to the Cordova API.

Actually this issue coincidentally is timed very well as we are just starting a discussion
about what, if any, abstraction over file system URIs are needed in Cordova. The discussion
starts [here|http://mail-archives.apache.org/mod_mbox/incubator-callback-dev/201202.mbox/%3CCADjNb+nsrJ2V-SfptWrHUAdsTsRKnbdFCLO-NijW-LwqPLd6zA@mail.gmail.com%3E]
- feel free to chime in.
                
      was (Author: filmaj):
    I agree this is an important feature, but I think we need to carefully frame the problem.

What exactly do you mean by "root"? Root of the application location, or root of the device
file system? Why exactly do you need the "root" location? My point is, are you simply looking
for a permanent / persistent location on the device to write and read files from, for use
with your app? If so, then we have an existing method ([window.requestFileSystem and the LocalFileSystemhttp://docs.phonegap.com/en/1.4.1/phonegap_file_file.md.html#LocalFileSystem])
that can get you both a temporary and a persistent file system location independent of your
device. 

The trickiness with asking for "root" is the differing security constraints across all of
the Cordova platforms.

My opinion is, if you are looking for a "safe" location to read and write files to in a cross-platform
way, I would use the requestFileSystem method and work from there. If there are issues with
using this method, then we should figure those out, instead of adding a new property somewhere
to the Cordova API.

Actually this issue coincidentally is timed very well as we are just starting a discussion
about what, if any, abstraction over file system URIs are needed in Cordova. The discussion
starts [here|http://mail-archives.apache.org/mod_mbox/incubator-callback-dev/201202.mbox/%3CCADjNb+nsrJ2V-SfptWrHUAdsTsRKnbdFCLO-NijW-LwqPLd6zA@mail.gmail.com%3E]
- feel free to chime in.
                  
> Add property returning root path of PhoneGap files
> --------------------------------------------------
>
>                 Key: CB-285
>                 URL: https://issues.apache.org/jira/browse/CB-285
>             Project: Apache Callback
>          Issue Type: Improvement
>          Components: CordovaJS
>    Affects Versions: 1.4.0
>         Environment: Both PhoneGap SDK and PhoneGap Build
>            Reporter: Ashley Gullen
>              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 (www.scirra.com), 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: http://phonegap.tenderapp.com/discussions/questions/208-android_asset-equivalent-for-ios

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message