You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Ian Clelland (JIRA)" <ji...@apache.org> on 2014/02/12 04:17:19 UTC

[jira] [Commented] (CB-6015) FileTransfer error: Read-Only filesystem

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

Ian Clelland commented on CB-6015:
----------------------------------

What version of file-transfer are you using with this? I think you may need to upgrade to the latest file-transfer, if this isn't working for you.

>From the stacktrace, it appears that you are trying to use the {{fullPath}} property of the FileEntry object as the location to save to.

{{FileEntry.fullPath}} _used_ to be a device-filesystem path from the root of your Android filesystem to the actual file location (something like {{/data/data/app-name/avatar.jpeg}} or {{/storage/emulated/0/sdcard/avatar.jpeg}},) but now, conforming to the actual spec, is the path _relative to the root of the filesystem_, so just {{/avatar.jpeg}}.

What would happen now in that case is that "{{/avatar.jpeg}}" looks like a path to a file in the root directory, which definitely is read-only. File-transfer complains because it can't write to the root.

What you can do in that case is use the FileEntry's {{toURL()}} method to get an actual url like {{cdvfile://localhost/persistent/avatar.jpeg}} that you can pass to the new version of file-transfer.download. (It should even work with the old version of file, since {{toURL()}} used to just return the fullPath property).

> FileTransfer error: Read-Only filesystem
> ----------------------------------------
>
>                 Key: CB-6015
>                 URL: https://issues.apache.org/jira/browse/CB-6015
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Android, Plugin File, Plugin File Transfer
>    Affects Versions: 3.3.0
>            Reporter: Darryl Pogue
>
> Using the FileTransfer plugin to write to a FileEntry returned from the File plugin results in an error.
> {code}
> D/FileTransfer(12423): download http://example.com/image.jpeg to //avatar.jpeg
> E/FileTransfer(12423): {"target":"\/\/avatar.jpeg","source":"http:\/\/example.com\/image.jpeg","http_status":0,"code":1}
> E/FileTransfer(12423): java.io.FileNotFoundException: /avatar.jpeg: open failed: EROFS (Read-only file system)
> E/FileTransfer(12423): 	at libcore.io.IoBridge.open(IoBridge.java:409)
> E/FileTransfer(12423): 	at java.io.FileOutputStream.<init>(FileOutputStream.java:88)
> E/FileTransfer(12423): 	at org.apache.cordova.CordovaResourceApi.openOutputStream(CordovaResourceApi.java:293)
> E/FileTransfer(12423): 	at org.apache.cordova.CordovaResourceApi.openOutputStream(CordovaResourceApi.java:274)
> E/FileTransfer(12423): 	at org.apache.cordova.filetransfer.FileTransfer$4.run(FileTransfer.java:708)
> E/FileTransfer(12423): 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
> E/FileTransfer(12423): 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
> E/FileTransfer(12423): 	at java.lang.Thread.run(Thread.java:841)
> E/FileTransfer(12423): Caused by: libcore.io.ErrnoException: open failed: EROFS (Read-only file system)
> E/FileTransfer(12423): 	at libcore.io.Posix.open(Native Method)
> E/FileTransfer(12423): 	at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
> E/FileTransfer(12423): 	at libcore.io.IoBridge.open(IoBridge.java:393)
> E/FileTransfer(12423): 	... 7 more
> {code}
> This worked correctly before upgrading the file plugin.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)