You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2018/10/02 00:20:05 UTC

[GitHub] premtemp1 opened a new issue #258: Not seeing any files on the android device

premtemp1 opened a new issue #258: Not seeing any files on the android device
URL: https://github.com/apache/cordova-plugin-file/issues/258
 
 
   Hello,
     I trying to read android folder and show the user a list of files but I am NOT seeing any files that I have uploaded in any folders.
   
     var localURLs = [
                   cordova.file.applicationDirectory,
                   cordova.file.applicationStorageDirectory,
                   cordova.file.cacheDirectory,
                   cordova.file.dataDirectory,
                   cordova.file.externalRootDirectory , 
                   cordova.file.externalApplicationStorageDirectory,
                   cordova.file.externalCacheDirectory,
                   cordova.file.externalDataDirectory
   
               ];
               var index = 0;
               var i;
               var errorStr = '';
               var fileList = [];
               var addFileEntry = function (entry) {
                   var dirReader = entry.createReader();
                   dirReader.readEntries(
                       function (entries) {
   
                           var i;
                           for (i = 0; i < entries.length; i++) {
                               if (entries[i].isDirectory === true) {
                                   // Recursive -- call back into this subdirectory
                                   addFileEntry(entries[i]);
                               } else {
                                   var ext = entries[i].name.split('.').pop();
                                   if (ext === 'doc' || ext === 'docx' ||
                                       ext === 'rdf' || ext === 'pdf' || ext === 'txt' ||
                                       ext === 'odt') {
   
                                       fileList.push(entries[i]); // << replace with something useful
                                   }
                                   index++;
                               }
                           }
                       },
                       function (error) {
                           console.log('readEntries error: ' + error.code);
                           errorStr += '<p>readEntries error: ' + error.code + '</p>';
                       }
                   );
               };
               var addError = function (error) {
                   console.log('getDirectory error: ' + error.code);
                   errorStr += '<p>getDirectory error: ' + error.code + ', ' + error.message + '</p>';
               };
               for (i = 0; i < localURLs.length; i++) {
                   if (localURLs[i] === null || localURLs[i].length === 0) {
                       continue; // skip blank / non-existent paths for this platform
                   }
                   window.resolveLocalFileSystemURL(localURLs[i], addFileEntry, addError);
               }
               $scope.fileList = fileList;
               $scope.localFileError = errorStr;
   
   Can you please let me know how to fix this issue.
   
   Thanks

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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