Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-9020

cordova.file undefined on WP8

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Duplicate
    • 2.0.0
    • None
    • cordova-plugin-file
    • None
    • Windows Phone 8 emulator

    Description

      I have some code that tries to list all of the files in www/json. It works correctly on iOS and Android but fails on Windows Phone 8.1.

      The code is pretty straight forward:
      window.resolveLocalFileSystemURL(cordova.file.applicationDirectory+'/www/json',
      function(dirEntry){

      var directoryReader = dirEntry.createReader();

      directoryReader.readEntries(
      function(entries){
      ups_json_file_count = entries.length;
      var i;
      for (i=0; i < ups_json_file_count; i++)

      { $.getJSON("json/"+entries[i].name, parse_json_files); }

      },
      function()

      { console.log("Coudl Not Locate JSON Files. 2"); }

      );
      },
      function(error)

      { console.log("Could Not Locate JSON Directory. 1"); }

      );

      After doing some digging I found that cordova.file is coming up as undefined. The above code is being called inside of the onDeviceReady function.

      cordova-plugin-file 2.0.0 "File"
      cordova-plugin-file-transfer 1.0.0 "File Transfer"

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              rparkm Rex Park
              Votes:
              2 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: