cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rex Park (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CB-9020) cordova.file undefined on WP8
Date Tue, 12 May 2015 21:23:00 GMT
Rex Park created CB-9020:
----------------------------

             Summary: cordova.file undefined on WP8
                 Key: CB-9020
                 URL: https://issues.apache.org/jira/browse/CB-9020
             Project: Apache Cordova
          Issue Type: Bug
          Components: Plugin File
    Affects Versions: 2.0.0
         Environment: Windows Phone 8 emulator
            Reporter: Rex Park
            Priority: Critical


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"



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


Mime
View raw message