Cordova 3.4 resolveLocalFileSystemURI on file:// uri

时间:2014-03-13 16:09:48

标签: android cordova

我使用Genymotion模拟器在Android上使用Cordova 3.4运行以下命令:

window.resolveLocalFileSystemURL('file:///storage/emulated/0/DCIM/Camera/1394726081689.jpg', function(entry) {
    console.log(entry.fullPath);
    console.log(entry.toURL());
    entry.file(fileSuccess, fail);
});

我在logcat中得到以下内容:

I/chromium( 3022): [INFO:CONSOLE(28)] "file:///storage/emulated/0/DCIM/Camera/1394726081689.jpg", source: file:///android_asset/www/js/pdf.js (28)
I/chromium( 3022): [INFO:CONSOLE(29)] "cdvfile://localhost/temporary/file://storage/emulated/0/DCIM/Camera/1394726081689.jpg", source: file:///android_asset/www/js/pdf.js (29)
W/System.err( 2928): java.io.FileNotFoundException: File: cdvfile://localhost/persistent/file://storage/emulated/0/DCIM/Camera/1394726081689.jpg does not exist.
W/System.err( 2928):    at org.apache.cordova.file.FileUtils.getFileMetadata(FileUtils.java:953)
W/System.err( 2928):    at org.apache.cordova.file.FileUtils.access$400(FileUtils.java:53)
W/System.err( 2928):    at org.apache.cordova.file.FileUtils$14.run(FileUtils.java:220)
W/System.err( 2928):    at org.apache.cordova.file.FileUtils$23.run(FileUtils.java:325)
W/System.err( 2928):    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
W/System.err( 2928):    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
W/System.err( 2928):    at java.lang.Thread.run(Thread.java:841)

相同的代码在iOS上运行良好。我已尝试将此部分传递给resolveLocalFileSystemURL

DCIM/Camera/1394726081689.jpg 

希望entry.file使用此网址:

cdvfile://localhost/temporary/DCIM/Camera/1394726081689.jpg

但是这会返回一个丢失的协议错误。

我确定这是一个错误,但我希望有人确认一下。谢谢!

1 个答案:

答案 0 :(得分:1)

是的,这是在cordova 3.5.0 https://issues.apache.org/jira/browse/CB-5398中修复的错误 我正在等待它自己被释放。