示例#1
0
文件: index.js 项目: bss/dev_proxy
  create_config_file: function (state) {
    var dir = state.config_path.dirname()

    function translate() {
      return state;
    }

    if (!dir.isDirectory()) {
      dir.mkdir();
    }
    if (!state.config_path.exists()) {
      return PATH.newPath(__dirname).dirname().append('examples', 'rails.coffee')
        .copy(state.config_path)
        .then(translate);
    }
    return state;
  },
示例#2
0
文件: watch.js 项目: Chandler/scinia
// returns the parent dir of the file located at path
function sourceFromPath(path) {
  var parts = FP.newPath(path).split();
  return parts[parts.length - 2];
} 
//get a reference to the filepath module
var fp = require('filepath'),
    //get a reference to the folder structure that leads up to the current file, 
    //set it to the path variable
    path = fp.newPath(),
    //get a reference to a list of all files in the current folder
    files = path.list();

//for each file name in the files array
files.forEach(function (fileName) {
    //output the full path to this file
    console.log(fileName.toString());
});