Locates & sets up project
Path is only needed for testing, usual case `pwd` by default

@param {String}
@api private
198439
function Project(path) {
  path = path || PWD;
  this.root = '';
  this.storage = '';
  this.ignore = [];
  this.resolvePaths(path);
}
1055824
function onDirectory() {
      var this_SendStream = this;
      if (!/\/$/.test(reqUrl.pathname)) {
        // No trailing slash? Redirect to add one
        res.writeHead(301, {
          'Location': reqUrl.pathname + '/' + (reqUrl.search || '')
        });
        res.end();
        deferred.resolve(true);
        return;
      }

      var indexPath = path.normalize(path.join(
        self.$root, unescape(this.path), 'index.html'));

      fs.exists(indexPath, function(exists) {
        if (exists) {
          // index.html exists, just serve that. This is the same as
          // the below call except without onDirectory and without
          // .index(false)
          send(req, suffix, {root: self.$root})
            .on('error', onError)
            .on('stream', onStream)
            .pipe(res);
          deferred.resolve(true);
        } else {
          // Either serve up 404, or the directory auto-index
          if (!self.$dirIndex) {
            deferred.resolve(null);
          } else {
            deferred.resolve(
              self.$autoindex_p(req, res, this_SendStream.path, self.$blacklist)
            );
          }
        }
      });
    }
240989
function isDirectoryExcluded(path) {
        var excludes = preferences.getExcludedDirectories();

        if (!excludes) {
            return false;
        }

        var testPath = ProjectManager.makeProjectRelativeIfPossible(path);
        testPath = FileUtils.stripTrailingSlash(testPath);

        return excludes.test(testPath);
    }
601325
function getProjectPathFromHubID(id) {
		var query = sharedProject.findOne({hubid: id}, 'location');
		return query.exec()
		.then(function(doc) {
			return doc ? doc.location : undefined;
		});
	}
1217203
function(app, route) {
    var resolvedPath = path.resolve(route.path.trim());
    var message = 'Setup static path: ' + resolvedPath.yellow;
    if (route.mount) {
        message += ' from url ' + route.mount.blue;
        app.use(route.mount, express.static(resolvedPath));
    } else {
        app.use(express.static(resolvedPath));
    }
    logger.log(message);
}
166863
function() {
        let xcConfigBuildFilePath = path.join(cwd, 'platforms', 'ios', 'cordova', 'build.xcconfig');

        try {
            let xcConfigBuildFileExists = fs.accessSync(xcConfigBuildFilePath);
        }
        catch(e) {
            console.log('Could not locate build.xcconfig, you will need to set HEADER_SEARCH_PATHS manually');
            return;
        }

        console.log(`xcConfigBuildFilePath: ${xcConfigBuildFilePath}`);

        addHeaderSearchPaths(xcConfigBuildFilePath);
    }
1251825
function CommonJsProject(opts) {
  this.roots = opts.roots;
  this.textPluginPattern = opts.textPluginPattern || /^text!/;

  opts.roots = this.roots.map(function(root) {
    if (!copy.isDirectory(root)) {
      throw new Error('Each commonjs root should be a directory: ' + root);
    }
    return ensureTrailingSlash(root);
  }, this);

  // A module is a Location that also has dep
  this.currentModules = {};
  this.ignoredModules = {};
}
627728
function (path) {
            var foundPath = self.PathTool.findLibScript(path);
            if (foundPath) {
                self.scriptList.push(foundPath);
            } else {
                self.logger.warn('script:%s not found!', path);
            }
        }
985817
function setupConfigurationFile(configFilePath) {
    const fileName = '.wistrc.json';

    try {
        let contents = require(configFilePath);
        fs.writeFileSync(fileName, JSON.stringify(contents, null, 2));
        log.info(`Initialized directory with a ${fileName}`)
    } catch (e) {
        console.error(e.message);
        return 1;
    }
    return 0;
}
561478
def set_root_path(self, root_path):
        """"""
        if self.name is None:
            self.name = osp.basename(root_path)
        self.root_path = to_text_string(root_path)
        config_path = self.__get_project_config_path()
        if osp.exists(config_path):
            self.load()
        else:
            if not osp.isdir(self.root_path):
                os.mkdir(self.root_path)
            self.save()
409104
function(path) {
  var loc = window.location;

  if (path[path.length-1] === '/') {
    path = path.slice(0, -1);
  }

  if (~path.indexOf('//')) { 
    return path;
  }

  var auth = /^[^:\/]+:\/\/[^\/]+/.exec(loc.href)[0];

  if (path[0] === '/') {
    path = auth + path;
  } else {
    path = path.replace(/^\.?\//, '');
    loc = loc.pathname.replace(/^\/|\/$/g, '');
    path = [auth, loc, path].join('/');
  }

  return path;
}
1049740
function(project, relativeFilePath, appPath){
			var deferred = new Deferred();
			var self = this;

			if(project.ContentLocation === relativeFilePath){
				/* use the project root as deployment path */
				deferred.resolve({
					path: relativeFilePath,
					appPath: appPath
				});

				return deferred;
			}

			/* use the project as deployment path */
			deferred.resolve({
				path: relativeFilePath,
				appPath: appPath || "" /* Note that the appPath has to be updated as well */
			});

			return deferred;
		}
138302
function () {
    var projectPath = path.resolve(cwd, './__publish__');
    projectPublishRoot = projectPath;
    if (!fs.existsSync(path.resolve(cwd, './__publish__'))) {
        fs.mkdirSync(path.resolve(cwd, './__publish__'));
    }
    fs.mkdirSync(projectPath + '/styles');
    fs.mkdirSync(projectPath + '/scripts');
    fs.mkdirSync(projectPath + '/statics');

    pageToPublish.forEach(function (subPage) {
        var dirPath = getPageDir(subPage);
        if (!fs.existsSync(dirPath)) {
            shell.mkdir('-p', dirPath);
        }
    });
}
927802
function initDir(path, title) {
  if (fis.util.exists(path)) {
    if (!fis.util.isDir(path)) {
      fis.log.error('unable to set path[%s] as %s directory.', path, title);
    }
  } else {
    fis.util.mkdir(path);
  }
  path = fis.util.realpath(path);
  if (path) {
    return path;
  } else {
    fis.log.error('unable to create dir [%s] for %s directory.', path, title);
  }
}
853176
function findModulePath(request, parent) {
  var mainScriptDir = path.dirname(Module._resolveFilename(request, parent));
  var resolvedModule = Module._resolveLookupPaths(request, parent);
  var paths = resolvedModule[1];
  for (var i = 0, PL = paths.length; i < PL; i++) {
    if (mainScriptDir.indexOf(paths[i]) === 0) {
      return path.join(paths[i], request.replace('/', path.sep));
    }
  }
  return null;
}
205697
function getProjectRootDirectory() {
  // From the current directory, check if parent directories have a package.json file and if it contains
  // a reference to the @myrmex/core node_module
  let cwd = process.cwd();
  let packageJson;
  let found = false;

  do {
    try {
      packageJson = require(path.join(cwd, 'package.json'));
      if ((packageJson.dependencies && packageJson.dependencies['@myrmex/core'])
        || (packageJson.devDependencies && packageJson.devDependencies['@myrmex/core'])) {
        found = true;
      } else {
        cwd = path.dirname(cwd);
      }
    } catch (e) {
      cwd = path.dirname(cwd);
    }
  } while (cwd !== path.dirname(cwd) && !found);
  if (found) {
    return cwd;
  }
  return false;
}
792253
function makedir(p,mode,next){
    if (typeof mode === 'function' || mode === undefined) {
        next = mode;
        mode = 0777 & (~process.umask());
    }
    if (typeof mode === 'string') mode = parseInt(mode, 8);
    p = path.resolve(p);
    // recursively make sure that directory exists.
    //

    var parent = path.dirname(p);
    if(parent){
        fs.exists(p,handleStatforPath(p,mode,parent,next));
    }else{
        // following convention, if the path is actually a dot at this
        // point, prepend the current process root dir and carry on
        // back up the stack.
        //
        if(p === '.'){
            // replace . with rootdir
            p = rootdir;
            // recurse back up with that value
            return next(null,p)
        }

        //
        // not sure what is up.  path.dirname should create '.' for
        // parent of relative path names
        //
        console.log('in make parent dir, no parents left for : '+p+' try prepending the process root dir');
        throw new Error('parent failure ' + p);
    }
    return null;
}