"Fossies" - the Fresh Open Source Software Archive

Member "Atom/resources/app/apm/lib/fs.js" (8 Mar 2017, 974 Bytes) of archive /windows/misc/atom-windows.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Javascript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 (function() {
    2   var _, fs, fsAdditions, ncp, rm, wrench;
    3 
    4   _ = require('underscore-plus');
    5 
    6   fs = require('fs-plus');
    7 
    8   ncp = require('ncp');
    9 
   10   rm = require('rimraf');
   11 
   12   wrench = require('wrench');
   13 
   14   fsAdditions = {
   15     list: function(directoryPath) {
   16       var e, error1;
   17       if (fs.isDirectorySync(directoryPath)) {
   18         try {
   19           return fs.readdirSync(directoryPath);
   20         } catch (error1) {
   21           e = error1;
   22           return [];
   23         }
   24       } else {
   25         return [];
   26       }
   27     },
   28     listRecursive: function(directoryPath) {
   29       return wrench.readdirSyncRecursive(directoryPath);
   30     },
   31     cp: function(sourcePath, destinationPath, callback) {
   32       return rm(destinationPath, function(error) {
   33         if (error != null) {
   34           return callback(error);
   35         } else {
   36           return ncp(sourcePath, destinationPath, callback);
   37         }
   38       });
   39     }
   40   };
   41 
   42   module.exports = _.extend({}, fs, fsAdditions);
   43 
   44 }).call(this);