我使用Cordova.FileSystem有以下问题:无论我做什么,似乎我都无法进入设备根目录,我总是得到/ storage / emulated / 0。这个API的文档有点稀疏,所以我希望这里的人能够带给我更多。以下是我到目前为止的情况:
document.addEventListener('deviceready', function () {
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, onFileSystemSuccess, fail);
}, false);
function onFileSystemSuccess(fileSystem) {
fileSystem.root.getDirectory("", { create: false, exclusive: false }, getDirSuccess, fail);
}
function getDirSuccess(dirEntry) {
var directoryReader = dirEntry.createReader();
directoryReader.readEntries(readerSuccess, fail);
}
Config.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<widget id="com.ionicframework.wakeme920893" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>WakeMe</name>
<description>
An Ionic Framework and Cordova project.
</description>
<author email="hi@ionicframework" href="http://ionicframework.com/">
Ionic Framework Team
</author>
<content src="index.html"/>
<access origin="*"/>
<preference name="webviewbounce" value="false"/>
<preference name="UIWebViewBounce" value="false"/>
<preference name="DisallowOverscroll" value="true"/>
<preference name="BackupWebStorage" value="none"/>
<preference name="AndroidPersistentFileLocation" value="Internal" />
<preference name="iosExtraFilesystems" value="library,library-nosync,documents,documents-nosync,cache,bundle,root" />
<preference name="AndroidExtraFilesystems" value="root" />
<feature name="StatusBar">
<param name="ios-package" value="CDVStatusBar" onload="true"/>
</feature>
<cdv:plugin name="org.apache.cordova.contacts" />
<cdv:plugin name="nl.x-services.plugins.socialsharing" />
<feature name="Contacts">
<param name="ios-package" value="CDVContacts" />
<param name="android-package" value="org.apache.cordova.contacts.ContactManager"/>
</feature>
</widget>