Permalink
Browse files

If file.searchParentPath includes the optional beginPath argument, it…

… will use that instead of process.cwd(). Main usage of it is in Geddy where we need to check for JS and Coffee files, because it changes the working path.
  • Loading branch information...
1 parent 12ffeb7 commit a7e1ba85fd8f3c34e15f89e7957f99759f33ce7d @larzconwell larzconwell committed Oct 8, 2012
Showing with 6 additions and 2 deletions.
  1. +6 −2 lib/file.js
View
@@ -322,8 +322,12 @@ var fileUtils = new (function () {
};
// Search for a directory in parent directories if it can't be found in cwd
- this.searchParentPath = function(location, callback) {
- var cwd = process.cwd();
+ this.searchParentPath = function(location, beginPath, callback) {
+ if (typeof beginPath === 'function' && !callback) {
+ callback = beginPath;
+ beginPath = process.cwd();
+ }
+ var cwd = beginPath || process.cwd();
if(!location) {
// Return if no path is given

0 comments on commit a7e1ba8

Please sign in to comment.