Software Archive
Read-only legacy content
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
17060 Discussions

Filesystem and emulator

Tony_T_
Beginner
711 Views

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));
    }  

0 Kudos
1 Reply
Rakshith_K_Intel
Employee
711 Views

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

 

 

0 Kudos
Reply