Example #1
0
 function listSubDirectories(dirPath) {
   console.log("Listing sub directories: " + dirPath);
   TSCORE.showLoadingAnimation();
   TSCORE.IO.listDirectoryPromise(dirPath).then(function(entries) {
     var anotatedDirList = [];
     var firstEntry = 0;
     // skiping the first entry pointing to the parent directory
     if (isChrome) {
       firstEntry = 1;
     }
     for (var i = firstEntry; i < entries.length; i++) {
       if (!entries[i].isFile) {
         anotatedDirList.push({
           "name": entries[i].name,
           "path": entries[i].path
         });
       }
     }
     TSPOSTIO.listSubDirectories(anotatedDirList, dirPath);
   }).catch(function(error) {
     TSPOSTIO.errorOpeningPath(dirPath);
     TSCORE.hideLoadingAnimation();
     console.error("Error listDirectory " + dirPath + " error: " + error);
   });
 }
Example #2
0
 function walkDirectory(path, options, fileCallback, dirCallback) {
   return TSCORE.IO.listDirectoryPromise(path, true).then(function(entries) {
     return Promise.all(entries.map(function(entry) {
       if (!options) {
         options = {};
         options.recursive = false;
       }
       if (entry.isFile) {
         if (fileCallback) {
           return fileCallback(entry);
         } else {
           return entry;
         }
       } else {
         if (dirCallback) {
           return dirCallback(entry);
         }
         if (options.recursive) { //  && !stopDirectoryWalking &&
           return walkDirectory(entry.path, options, fileCallback, dirCallback);
         } else {
           return entry;
         }
       }
     }));
   }).catch(function(err) {
     console.warn("Error walking directory " + err);
     return null;
   });
 }
 var promise = new Promise(function(resolve, reject) {
   var extensions = [];
   TSCORE.IO.listDirectoryPromise(extFolderPath).then(function(dirList) {
     var readBowerFileWorkers = [];
     for (var i in dirList) {
       var dirItem = dirList[i];
       if (!dirItem.isFile) {
         var filePath = dirItem.path + TSCORE.dirSeparator + bowerFileName;
         readBowerFileWorkers.push(loadBowerData(filePath));
       }
     }
     Promise.all(readBowerFileWorkers).then(function(bowerObjects) {
       bowerObjects.forEach(function(bowerObject) {
         if (bowerObject) {
           extensions.push(bowerObject);
         }
       });
       TSCORE.Config.setExtensions(extensions);
       resolve();
     }).catch(function(err) {
       console.warn("reading of at least one bower.json file failed: " + err);
       resolve();
     });
   }).catch(function(err) {
     console.warn("loadExtensionData failed with error: " + err);
     resolve();
   });
 });
 var refreshFileListContainer = function() {
   // TODO consider search view
   TSCORE.IO.listDirectoryPromise(TSCORE.currentPath).then(function(entries) {
     TSPOSTIO.listDirectory(entries);
   }).catch(function(err) {
     TSPOSTIO.errorOpeningPath(TSCORE.currentPath);
     console.warn("Error listing directory" + err);
   });
 };
Example #5
0
 function cancelSearch() {
   clearSearchFilter();
   // Restoring initial dir listing without subdirectories
   TSCORE.IO.listDirectoryPromise(TSCORE.currentPath).then(
     function(entries) {
       TSPOSTIO.listDirectory(entries);
     }
   ).catch(function(err) {
     TSPOSTIO.errorOpeningPath(TSCORE.currentPath);
     console.warn("Error listing directory" + err);
   });
 }
Example #6
0
  function listDirectory(dirPath) {
    TSCORE.showLoadingAnimation();
    TSCORE.PerspectiveManager.removeAllFiles();
    TSCORE.IO.listDirectoryPromise(dirPath).then(function(entries) {
      TSPOSTIO.listDirectory(entries);
      console.log("Listing: " + dirPath + " done!");
    }).catch(function(err) {
      TSPOSTIO.errorOpeningPath();
      console.log("Error listing directory" + err);
    });

    if (TSCORE.PRO && TSCORE.Config.getEnableMetaData()) {
      TSCORE.Meta.createMetaFolder(dirPath);
    }
  }
Example #7
0
 function getDirectoryMetaInformation() {
   var metaFolderPath = TSCORE.currentPath + TSCORE.dirSeparator + TSCORE.metaFolder;
   console.log("getDirectoryMetaInformation: " + metaFolderPath);
   return TSCORE.IO.listDirectoryPromise(metaFolderPath, true);
 }