Example #1
0
path.add = function(p){
  if(Array.isArray(p)) return p.map(path.add);

  if(path.contains(p)) return false;

  process.env.PATH = p + path.delimiter + process.env.PATH;
  path._additions.push(p);
  return true;
};
Example #2
0
path.remove = function(p){
  if(Array.isArray(p)) return p.map(path.remove);

  if(!path.contains(p)) return false;

  var _paths = process.env.PATH.split(path.delimiter);
  _paths.splice(_paths.indexOf(p), 1);
  process.env.PATH = _paths.join(path.delimiter);

  if(path._additions.indexOf(p)){
    path._additions.splice(path._additions.indexOf(p), 1);
  }
  return true;
};