我在设备就绪时触发了这个简单的代码:
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function(fs){
var imagesRootPath = fs.root.fullPath;
navigator.notification.alert(imagesRootPath);
},
function(evt) { navigator.notification.alert(evt.target.error.code)});
Run Code Online (Sandbox Code Playgroud)
在具有Phonegap 3.2的MAC专业版中,这非常有效,当代码在模拟器中运行时,imagesRootPath是一个长字符串路径.当我在Ipod设备中运行此代码时,我得到了其他不同的长路径.
现在,当我在具有与Mac Pro相同的MacOS的NOTEBOOK中运行此代码,但具有Phonegap 3.3时,我在模拟器中仅获得"/"(斜杠)路径,并在我部署Phonegap应用程序时使用相同的斜杠装置.
我为文件API做了正确的插件配置.
可能有什么不对?
谢谢!
xud*_*dre 10
在当前的插件开发分支中有一个解决方案:
Entry.toNativeURL() - 返回设备FileSystem中文件的完整路径.
https://github.com/apache/cordova-plugin-file/tree/dev
小智 9
最新版本的Cordova改变了File插件与路径的显着方式.您所看到的实际上是File插件的预期行为(如果您使用之前的文档).(我的旧代码遇到了完全相同的问题).
http://cordova.apache.org/news/2014/02/10/plugins-release.html https://github.com/apache/cordova-plugin-file/blob/dev/doc/index.md - check出了升级说明.
| 归档时间: |
|
| 查看次数: |
10590 次 |
| 最近记录: |