cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Boston Dell-Vandenberg (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CB-5899) FileError code 5 returned with dirEntry.readEntries()
Date Sun, 26 Jan 2014 17:02:38 GMT

    [ https://issues.apache.org/jira/browse/CB-5899?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13882352#comment-13882352
] 

Boston Dell-Vandenberg commented on CB-5899:
--------------------------------------------

After more testing I've found it only occurs on the dev branch of the file plugin: https://github.com/apache/cordova-plugin-file/tree/dev

I'm using the dev branch because it contains file / file transfer fixes for BlackBerry 10.

This js code can reproduce the problem (note I'm arbitrarily picking a sub directory to demonstrate):

{code:javascript}
            var fp, el, count = 0;

            var showLocalFiles = function () {
                fp = {};
                fp.currPath = '';
                fp.currEntry = null;
                fp.fileEntries = [];

                fp.getRoot = function (callback) {
                  window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function (fileSystem)
{
                    fp.rootPath = fileSystem.root.fullPath;
                    fp.getEntries(fileSystem.root);
                  }, function () {
                    console.log('Error accessing local file system');
                  });
                };

                fp.getEntries = function (dirEntry) {
                  if (dirEntry === null)
                    return;

                  var directoryReader = dirEntry.createReader();

                  fp.currPath = dirEntry.fullPath;
                  fp.currEntry = dirEntry;

                  directoryReader.readEntries(
                      function (entries) {
                        console.log('got entries: ', entries);

                        entries.sort(function (a, b) {
                          if (a.name.toLowerCase() < b.name.toLowerCase())
                            return -1;
                          if (a.name.toLowerCase() > b.name.toLowerCase())
                            return 1;
                          return 0;
                        });

                        fp.fileEntries = entries;

                        if (count === 0) {
                           fp.getEntries(fp.fileEntries[4]);
                           count++; 
                        }
                      },
                      function (error) {
                        console.log('Failed to list directory contents. Code = ' + error.code);
                      }
                    );

                };

                fp.getRoot();
              };

              

            window.addEventListener('load', function onload() {
                document.addEventListener('deviceready', showLocalFiles, false);
            }, false);
{code}

> FileError code 5 returned with dirEntry.readEntries()
> -----------------------------------------------------
>
>                 Key: CB-5899
>                 URL: https://issues.apache.org/jira/browse/CB-5899
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Android, Plugin File
>    Affects Versions: 3.3.0
>         Environment: Android 4.1, Android 4.4
>            Reporter: Boston Dell-Vandenberg
>
> When attempting to read entries of a DirectoryEntry from the local file system the plugin
returns an FileError code 5.
> I am able to successfully read the root directory of the local file system using window.requestFileSystem()
but creating a directoryReader and calling readEntries() of any sub directories of the root
file system results in the error.
> I am using Cordova 3.3 and have tried both 0.2.5 of the file plugin as well as the current
Dev branch.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Mime
View raw message