/* Returns the directory where file exists
972459
function search_dir(file) {
		var matches = [];
		foreach(_dirs).do(function(dir) {
			if(path.existsSync(dir+"/"+file)) matches.push(dir);
		});
		if(matches.length != 0) return matches.shift();
	}
549298
function getRealLocation(filepath) {
    	var segs = filepath.split(path.sep);
		var fileRoot = getfileRoot(segs[1]);
		var realPath = path.join("/", fileRoot, segs[2]);
		return realPath;
    }
1102881
private static File findResRawDir(File dir) {
		for (File file : dir.listFiles()) {
			if (file.getName().equals(RESOURCE_DIR_NAME) && file.isDirectory()) {
				File[] rawFiles = file.listFiles(new FileFilter() {
					@Override
					public boolean accept(File file) {
						return file.getName().equals(RAW_DIR_NAME) && file.isDirectory();
					}
				});
				if (rawFiles.length == 1) {
					return rawFiles[0];
				}
			}
		}
		return null;
	}
660907
function getContentOfDir(pathToDir) {
  return fs.readdirSync(pathToDir).filter(function(fileName) {
    return !hiddenReg.test(fileName);
  });
}
1041524
function isDirectory(filePath, callback) {
  try {
    fs.stat(filePath, function (err, data) {
      if (err) {
        callback(null, false);
      } else {
        callback(null, data.isDirectory());
      }
    });
  } catch (e) {
    callback(null, false);
  }
}
422862
function(fileName, content) {
                return Promise()
                .then(function() {
                    var filePath = PathUtils.resolveInRoot(outputFolder, fileName);

                    return fs.exists(filePath);
                });
            }
872281
def _file_exists(path, filename):
  """"""
  return os.path.isfile(os.path.join(path, filename))
1127231
def _options_file_exists(name):
    '''
    
    '''
    return os.path.isfile(os.path.join(_options_dir(name), 'options'))
291231
function defaultWindowsLocation() {
  var files = [
    process.env['PROGRAMFILES'] || 'C:\\Program Files',
    process.env['PROGRAMFILES(X86)'] || 'C:\\Program Files (x86)'
  ].map(function(prefix) {
    return path.join(prefix, 'Mozilla Firefox\\firefox.exe');
  });
  return io.exists(files[0]).then(function(exists) {
    return exists ? files[0] : io.exists(files[1]).then(function(exists) {
      return exists ? files[1] : null;
    });
  });
}
1057891
function checkForChangedFiles(dir) {
    var fileList = fs.readdirSync(dir);
    for (var i=0;i<fileList.length;i++) {
        if (!isWatching(fileList[i])) {
            continue;
        }
        if (!fs.existsSync(dir+fileList[i])) { continue; }
        var stats;
        try {
            stats = fs.statSync(dir + fileList[i]);
        }
        catch (err) {
            // this means the file disappeared between the exists and when we tried to stat it...
            continue;
        }
        if (timeStamps[dir+fileList[i]] === undefined || timeStamps[dir+fileList[i]] !== stats.mtime.getTime()) {
            //console.log("Found 1: ", dir+fileList[i], timeStamps[dir+fileList[i]], stats.mtime.getTime());

            timeStamps[dir+fileList[i]] = stats.mtime.getTime();
            return dir+fileList[i];
        }
    }
    return null;
}
110415
function fileExists( $path )
    {
        eZDebugSetting::writeDebug( 'kernel-clustering', "fs::fileExists( '$path' )", __METHOD__ );

        eZDebug::accumulatorStart( 'dbfile', false, 'dbfile' );
        $rc = file_exists( $path );
        eZDebug::accumulatorStop( 'dbfile' );

        return $rc;
    }
63697
function existence ( filepath ) {
		var does = grunt.file.exists ( filepath );
		if ( !does ) {
			grunt.log.warn ( filepath + " not found." );
		}
		return does;
	}
956640
function getDirectoriesInURL()
{
	var trail = document.location.pathname.split( PATH_SEPARATOR );

	// check whether last section is a file or a directory
	var lastcrumb = trail[trail.length-1];
	for( var i = 0; i < FILE_EXTENSIONS.length; i++ )
	{
		if( lastcrumb.indexOf( FILE_EXTENSIONS[i] ) )
		{
			// it is, remove it and send results
			return trail.slice( 1, trail.length-1 );
		}
	}

	// it's not; send the trail unmodified
	return trail.slice( 1, trail.length );
}
717234
function getDirectories(path){
  return fs.readdirSync(path).filter(function (file) {
    return fs.statSync(path + "/" + file).isDirectory();
  });	
}
85329
def has_directory(self, name: str):
        '''
        
        '''
        return os.path.isdir(self._path / name)
619503
function _findFile(filename) {
  var cwd = process.cwd();
  var parts = cwd.split(_path2.default.sep);
  do {
    var loc = parts.join(_path2.default.sep);
    if (!loc) break;

    var file = _path2.default.join(loc, filename);
    if (_fs2.default.existsSync(file)) {
      var fileObj = undefined;
      try {
        fileObj = require(file);
      } catch (e) {
        fileObj = _loadJSON(file);
      }
      return fileObj;
    }

    parts.pop();
  } while (parts.length);

  return null;
}
162411
function(file) {
    var filePath = path.resolve(file);

    if (filePath && fs.existsSync(filePath)) {
      return filePath;
    }

    return false;
  }