Try to find config file up the file tree.

@return {string|boolean} Config absolute file path.
773480
function findConfigFile() {
	let configDir
	try {
		configDir = findup.sync(process.cwd(), CONFIG_FILENAME)
	} catch (exception) {
		return false
	}

	return path.join(configDir, CONFIG_FILENAME)
}
1080105
function () {
    //Init Var
    var length = 0;
    //Loop filenames
    $.each(config.data, function () {
      length++;
    });
    //If value of length is equal to filenames length,
    // return true, if not, return false
    if (length === config.filenames.length) {
      return true;
    } else {
      return false;
    }
  }
1237662
function readConfig() {
  let options = {}
  let cFile = ''

  if (program.config) {
    cFile = path.resolve(cwd, program.config)
    if (fs.existsSync(cFile)) {
      Object.assign(config, require(cFile))
    } else {
      console.warn(`Cannot find configuration file ${program.config}`)
      process.exit()
    }
  } else {
    cFile = path.resolve(cwd, 'deploy.js')
  }

  if (fs.existsSync(cFile)) {
    options = require(cFile)
  }

  ;['server', 'ignore'].forEach(function(name) {
    if (typeof program[name] !== 'undefined') {
      options[name] = program[name]
    }
  })

  if (program.args[0]) {
    options.workspace = path.resolve(cwd, program.args[0])
  }

  if (program.args[1]) {
    options.deployTo = program.args[1]
  }

  return options
}
1143192
def find_root
      Pathname.pwd.ascend do |root|
        config_dir = root.join(Project::CONFIG_DIR)

        if config_dir.directory?
          config_file = config_dir.join(Project::CONFIG_FILE)
          return root if config_file.file?

          environments_dir = config_dir.join(Project::ENVIRONMENTS_DIR)
          return root if environments_dir.directory?
        end
      end

      shell.say "Could not find '#{Project::CONFIG_FILE}' in any parent directories", :red
      exit -1
    end
871261
public function get_global_config_path() {

		if ( getenv( 'WP_CLI_CONFIG_PATH' ) ) {
			$config_path                    = getenv( 'WP_CLI_CONFIG_PATH' );
			$this->global_config_path_debug = 'Using global config from WP_CLI_CONFIG_PATH env var: ' . $config_path;
		} else {
			$config_path                    = Utils\get_home_dir() . '/.wp-cli/config.yml';
			$this->global_config_path_debug = 'Using default global config: ' . $config_path;
		}

		if ( is_readable( $config_path ) ) {
			return $config_path;
		}

		$this->global_config_path_debug = 'No readable global config found';

		return false;
	}
788302
function(){
        var _replace    = "$1" + this.config.tp + "$2" + this.config.tp,
            _al         = this.config.jade.replace( /(^\s*)(script\([^\)|^\n|^\r]*\))/gm , _replace ).split( this.config.tp ),
            _url ,
            _filePath;
        for( var i = _al.length; i--; ){
            if( i % 2 ){
                _al[ i ]    = _al[ i ].replace( /\s/gi , "" );
                tool.checkFileStatus( _al[ i ].replace( /[^\:]*src=['|"]([^'|^"]*)['|"].*/gi , "$1" ) , function( exists , filePath ){
                    if( !config.filePath.fetchUrl[ filePath ] ){
                        _url    = tool.getFileTs( filePath );
                        if( exists ){
                            _filePath   = Path.parse( filePath );
                            _url = tool.uglifyJs( Path.join( config.dir.srcDir , filePath ) , _filePath.dir + "/" + _filePath.name + "." );
                            _url = config.redirectOrigin + _url;
                        }
                        config.filePath.fetchUrl[ filePath ] = _url;
                    }
                    _al[ i ] = _al[ i ].replace( /(.*src=['|"])([^'|^"]*)(['|"].*)/gi , "$1" + config.filePath.fetchUrl[ filePath ] + "$3" );
                } );
            };
        };
        return _al.join( "" );
    }
1337712
function findConfigFiles (dir) {
  let result = []

  if (typeof dir !== 'string' || !fs.existsSync(dir)) {
    return result
  }

  const fileList = fs.readdirSync(dir)

  debug(`${dir} file list: %o`, fileList)

  result = linterConfigFile
    .filter(fileName => fileList.includes(fileName))
    .map(fileName => path.join(dir, fileName))

  debug('config file: %o', result)

  return result
}
1231682
def load_config(filename):
    

    if filename is None:
        filename = ''

    abs_filename = os.path.join(os.getcwd(), filename)

    global FILE

    # find the config file
    if os.path.isfile(filename):
        FILE = filename
    elif os.path.isfile(abs_filename):
        FILE = abs_filename
    elif os.path.isfile(FILE):
        pass
    else:
        if os.path.dirname(filename):
            file_not_found = filename
        else:
            file_not_found = abs_filename
        file_not_found_message(file_not_found)

    # load config
    init(FILE)
284199
def find():
        """"""
        names = ('archan.yml', 'archan.yaml', '.archan.yml', '.archan.yaml')
        current_dir = os.getcwd()
        configconfig_file = os.path.join(current_dir, '.configconfig')
        default_config_dir = os.path.join(current_dir, 'config')
        if os.path.isfile(configconfig_file):
            logger.debug('Reading %s to get config folder path',
                         configconfig_file)
            with open(configconfig_file) as stream:
                config_dir = os.path.join(current_dir, stream.read()).strip()
        elif os.path.isdir(default_config_dir):
            config_dir = default_config_dir
        else:
            config_dir = current_dir
        logger.debug('Config folder = %s', config_dir)
        for name in names:
            config_file = os.path.join(config_dir, name)
            logger.debug('Searching for config file at %s', config_file)
            if os.path.isfile(config_file):
                logger.debug('Found %s', config_file)
                return config_file
        logger.debug('No config file found')
        return None
1326294
function getConfigFromFile(directories, filename) {
	const filepath = tryFile(directories, filename);
	if (!filepath) {
		return {};
	}

	return require(filepath);
}
1218966
def find_config(directory_or_file, debug=False):
    
    directory_or_file = os.path.realpath(directory_or_file)
    if os.path.isfile(directory_or_file):
        if debug:
            print('using config file {}'.format(directory_or_file),
                  file=sys.stderr)
        return directory_or_file
    directory = directory_or_file

    while directory:
        for filename in CONFIG_FILES:
            candidate = os.path.join(directory, filename)
            if os.path.exists(candidate):
                if debug:
                    print('using config file {}'.format(candidate),
                          file=sys.stderr)
                return candidate

        parent_directory = os.path.dirname(directory)
        if parent_directory == directory:
            break
        else:
            directory = parent_directory
147037
function getPath() {
  var p = info && info.config ? info.config : './config'
  if (p.charAt(0) === '/') return p
  return path.join(base, p)
}
803855
def config_file(*paths)
      Dir.chdir(root || '.') do
        paths.each do |pattern|
          Dir.glob(pattern) do |file|
            raise UnsupportedConfigType unless ['.yml', '.erb'].include?(File.extname(file))
            logger.info "loading config file '#{file}'" if logging? && respond_to?(:logger)
            document = ERB.new(IO.read(file)).result
            yaml = YAML.load(document)
            config = config_for_env(yaml)
            config.each_pair { |key, value| set(key, value) }
          end
        end
      end
    end
1371892
function getDir (config, name) {
    var base = config.base
    // get list of directories for name
    var dirs = config.dir[name]
    // make sure dirs is array
    if (!Array.isArray(dirs)) {
        dirs = dirs
    }
    // default dir is app base + dir name
    var defaultDir = base+'/'+name
    // if default dir exists then add it
    try {
        // will throw error if dir does not exists
        fs.statSync(defaultDir)
        // add default dir
        dirs.push(defaultDir)
    }
    // ignore errors
    catch (err) {}
    // get only the directories that exist
    config.dir[name] = _.filter(dirs, dir => {
        // if dir is relative then get abs from base
        if (!path.isAbsolute(dir)) {
            // get abs path from base and dir
            dir = base+'/'+dir
        }
        // stat dir
        try {
            var stat = fs.statSync(dir)
        }
        // throw error
        catch (err) {
            throw new Error(name+' dir error: '+err.message)
        }
        // debug
        debug('get dir %s: %s', name, stat ? dir : 'error')
        // return dir if exists or undefined
        return stat ? true : false
    })
    // return directories
    return config.dir[name]
}
314207
public function getConfigFilePath()
    {
        $path = null;
        $locator = $this->config->getLocator();

        if (is_array($this->file)) {
            $res = null;
            foreach ($this->file as $file) {
                if (($res = $locator->locate($file)) !== false) {
                    break;
                }
            }
            $path = $res->getPath();
        } else {
            $path = $locator->locate($this->file)->getPath();
        }

        return $path;
    }
1035046
function resolveConfigFilePath(project_dir, platform, file) {
    var filepath = path.join(project_dir, file);
    var matches;


    if (file.indexOf('*') > -1 && file.indexOf('plist') > -1) {
        project_dir = path.join(project_dir);
        // handle wildcards in targets using glob.
        matches = modules.glob.sync(path.join(project_dir, '**', file));
        if (matches.length) filepath = matches[0];
        else {
            project_dir = path.join(project_dir, '..');
            // handle wildcards in targets using glob.
            matches = modules.glob.sync(path.join(project_dir, '**', file));
            if (matches.length) filepath = matches[0];
        }

        // [CB-5989] multiple Info.plist files may exist. default to $PROJECT_NAME-Info.plist
        if(matches.length > 1 && file.indexOf('-Info.plist')>-1){
            var plistName =  getIOSProjectname(project_dir)+'-Info.plist';
            for (var i=0; i < matches.length; i++) {
                if(matches[i].indexOf(plistName) > -1){
                    filepath = matches[i];
                    break;
                }
            }
        }
        return filepath;
    }else if (platform === 'ios' && (file != 'config.xml' || file != 'JudpluginConfig.xml')){
        return filepath = path.join(project_dir, getIOSProjectname(project_dir), file);
    }

    // special-case config.xml target that is just "config.xml". This should be resolved to the real location of the file.
    // TODO: move the logic that contains the locations of config.xml from cordova CLI into plugman.
    if (file == 'config.xml') {
        if (platform == 'ubuntu') {
            filepath = path.join(project_dir, 'config.xml');
        } else if (platform == 'ios') {
            var iospath = getIOSProjectname(project_dir);
            filepath = path.join(project_dir,iospath, 'config.xml');
        } else if (platform == 'android') {
            filepath = path.join(project_dir, 'res', 'xml', 'config.xml');
        } else {
            matches = modules.glob.sync(path.join(project_dir, '**', 'config.xml'));
            if (matches.length) filepath = matches[0];
        }
        return filepath;
    }

    // XXX this checks for android studio projects
    // only if none of the options above are satisfied does this get called
    if(platform === 'android' && !fs.existsSync(filepath)) {
      // JUD_HOOK_START
      if (file === 'AndroidManifest.xml') {
          filepath = path.join(project_dir, 'judplugin', 'src', 'main', 'AndroidManifest.xml');
      } else {
          filepath = path.join(project_dir, 'judplugin', 'src', 'main', 'res', 'xml', 'config.xml');
      }
      // JUD_HOOK_END
    }

    // None of the special cases matched, returning project_dir/file.
    return filepath;
}
580772
function findConfig(file) {
  if (file) {
    // Custom config location

    const configFilepath = file[0] === '/'? file : path.join(process.cwd(), file);
    if (!fs.existsSync(configFilepath)) {
      throw new DvhbWebpackError('DvhbWebpack config not found: ' + configFilepath + '.');
    }

    return configFilepath;
  }

  // Search config file in all parent directories

  let configDir;
  try {
    configDir = findup.sync(__dirname, CONFIG_FILENAME);
  }
  catch (exception) {
    throw new DvhbWebpackError('DvhbWebpack config not found: ' + CONFIG_FILENAME + '.');
  }

  return path.join(configDir, CONFIG_FILENAME);
}