简体   繁体   English

Cordova 3.4 resolveLocalFileSystemURI on file:// uri

[英]Cordova 3.4 resolveLocalFileSystemURI on file:// uri

I run the following using Cordova 3.4 on Android using the Genymotion emulator: 我使用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);
});

I get the following in the logcat: 我在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)

The same code runs fine on iOS. 相同的代码在iOS上运行良好。 I've tried only passing this portion to resolveLocalFileSystemURL : 我试过只将这部分传递给resolveLocalFileSystemURL

DCIM/Camera/1394726081689.jpg 

in hope that entry.file would use this url: 希望entry.file将使用此url:

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

But that returns a missing protocol error. 但是这会返回丢失的协议错误。

I'm sure this is a bug but I would like someone to confirm this please. 我确定这是一个错误,但我希望有人确认这一点。 Thanks! 谢谢!

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM