You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "David Hayes (JIRA)" <ji...@apache.org> on 2015/04/03 16:24:54 UTC

[jira] [Comment Edited] (CB-7273) Using cordova.file.applicationDirectory, Android, and reading the file

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

David Hayes edited comment on CB-7273 at 4/3/15 2:24 PM:
---------------------------------------------------------

(function(log){
   window.resolveLocalFileSystemURL(cordova.file.applicationDirectory + "www/index.html",log,log);
})(function(loggable) { console.log(loggable) } );

This throws a FileError with code: 1 for me on Android.

In my particular case, I wish to list all the files currently located in the www folder (such as cordova.js, cordova_plugins.js and all the plugins themselves) so that I can copy them to cordova.file.applicationStorageDirectory. I wish to spark a CorHTTPD server from that folder, and dynamically add content to this folder (which I can't do against the local www directory) and have the cordova application run from the served CorHTTD instance instead. Not being able to access the www folder means I am completely scuppered.


was (Author: davidhayes):
(function(log){
   window.resolveLocalFileSystemURL(cordova.file.applicationDirectory + "www/index.html",log,log);
})(function(loggable) { console.log(loggable) } );

This throws a FileError with code: 1 for me on Android.

> Using cordova.file.applicationDirectory, Android, and reading the file
> ----------------------------------------------------------------------
>
>                 Key: CB-7273
>                 URL: https://issues.apache.org/jira/browse/CB-7273
>             Project: Apache Cordova
>          Issue Type: Bug
>            Reporter: Raymond Camden
>            Priority: Minor
>
> I wrote a simple app that uses the file system API to read a file from the www folder. The demo code may be found here:
> https://github.com/cfjedimaster/Cordova-Examples/blob/master/readtextfile/
> It uses this line essentially to handle the read:
> window.resolveLocalFileSystemURL(cordova.file.applicationDirectory + "www/index.html", gotFile, fail);
> This works fine in iOS, but fails to work in Android.  While you can work around this by just using a regular XHR get, the code really should work.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org