I want to create a windows app. On app initialize it has to check if a directory exist. If not create said directory. My problem is I - How do i test this condition in emulator. Does emulator support creating directory and sub directory..Do I have to build window app in order to check my code?
I get error.code of 1. when using following code in emulator
function onDeviceReady() {
window.requestFileSystem = window.requestFileSystem || window.webkitRequestFileSystem;
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, fail); }
function fail(error) {
console.log("failed to get filesystem");
alert("what is wrong "+error.code)
}
function gotFS(fileSystem) {
console.log("filesystem got filesystem");
fileSystem.root.getDirectory("mydir", {
create : true,
exclusive : false
}, dirReady, fail);
}
function dirReady(entry) {
console.log("filesystem in dir ready");
window.appRootDir = entry;
console.log(JSON.stringify(window.appRootDir));
}
Link Copied
You have build the app and install on device to test the app using File API.
Below are some examples for app that use file API to read/write to files: https://github.com/krisrak/html5-cordova-samples
For more complete information about compiler optimizations, see our Optimization Notice.