You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Axel Nennker (JIRA)" <ji...@apache.org> on 2014/05/29 16:21:01 UTC

[jira] [Commented] (CB-6777) window.requestFileSystem(LocalFileSystem.TEMPORARY returns "/"

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

Axel Nennker commented on CB-6777:
----------------------------------

This code is taken from the examples floating around in the web. It does not work.
Maybe it is more to the spec.
I do not want a url. I need one for FileTransfer.download
Is this not the right way to get a temorary filesystem, then create a file in it and pass that to download?
I am not saving an cdvfile url to some permanent storage or other things that were discussed during the release of the new version of file and file-transfer.

I think this code should work but it doesn't due to what I think is a bug in cordova.
Please reopen.

> window.requestFileSystem(LocalFileSystem.TEMPORARY returns "/"
> --------------------------------------------------------------
>
>                 Key: CB-6777
>                 URL: https://issues.apache.org/jira/browse/CB-6777
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Android
>    Affects Versions: 3.5.0
>            Reporter: Axel Nennker
>
> In the code below I get a 
> java.io.FileNotFoundException: /tmpfile.tmp: open failed: EROFS (Read-only file system) 
> because the request for a temporary filesystem returns "/".
> {code}
> 60           window.requestFileSystem(LocalFileSystem.TEMPORARY, 0, function(fs){
> 61 for (var p in fs.root) {
> 62   Framework.util.LogUtil.i(this.$className, 'getImport() fs.root['+p+'] =' + fs.root[p]);-
> 63 }
> 64               fs.root.getFile("tmpfile.tmp", {create: true, exclusive: false},
> 65                 function(entry){
> 66                   var fileTransfer = new FileTransfer();
> 67                   fileTransfer.download(
> 68                           aFile,
> 69                           entry.fullPath,
> 70                           function(entry) {
> 71                               console.log("download complete: " + entry.fullPath);
> 72                               aSuccess(entry);
> 73                           },
> 74                           function(error) {
> 75                               console.log("error source " + error.source);
> 76                               console.log("error target " + error.target);
> 77                               console.log("error code " + error.code);
> 78                               aFail(error);
> 79                           },
> 80                           false,
> 81                           {
> 82                              headers: {
> 83                               'Content-Type': 'application/json'
> 84                              }
> 85                           }
> 86                   );
> 87               }, function(error){
> 88                 Framework.util.LogUtil.e(this.$className, 'getImport() download error =' + error);-
> 89                 aFail(error);
> 90               });
> 91           }, null);
> 92 
> 93         },
> {code}
> I/Web Console(22297): [I]  :: getImport() fs.root[isFile] =false:37
> I/Web Console(22297): [I]  :: getImport() fs.root[isDirectory] =true:37
> I/Web Console(22297): [I]  :: getImport() fs.root[name] =:37
> I/Web Console(22297): [I]  :: getImport() fs.root[fullPath] =/:37
> I/Web Console(22297): [I]  :: getImport() fs.root[filesystem] =[object Object]:37
> I/Web Console(22297): [I]  :: getImport() fs.root[nativeURL] =null:37
> This happened after I updated the file and the file-transfer plugins in my project. It worked with the old versions (about one year older).
> Not sure what the temporary filesystem should be on Android but "/" is wrong.



--
This message was sent by Atlassian JIRA
(v6.2#6252)