We need to both load the config and resolve the paths it references based on
where the file is located.
197817
function loadAndResolveConfig(pathName: string): Config {
  debug('resolve', pathName);
  let loadedConfig = requireConfig(pathName);
  let config = {};

  // Resolve the plugin require paths...
  config.plugins = (loadedConfig.plugins || []).reduce((list, entry) => {
    // Check if the plugin is referencing a path or a plugin name. If this is a
    // plugin name prefix it.
    if (entry.indexOf('/') === -1) {
      entry = `${PLUGIN_PREFIX}${entry}`;
    }

    try {
      debug('resolve module', entry);
      list.push(resolve.sync(entry, {
        basedir: path.dirname(pathName),
      }));
    } catch (err) {
      log.warn(err.message);
    }

    return list;
  }, []);

  return config;
}
653825
def locate_config(confname, app_name,
                  location=None, prefix='etc', verbose=False):
    
    candidates = []
    if location:
        candidate = os.path.normpath(os.path.join(location, confname))
        if os.path.isfile(candidate):
            candidates += [candidate]
    candidate = os.path.normpath(os.path.join(
        os.path.dirname(os.path.dirname(sys.executable)),
        prefix, app_name, confname))
    if os.path.isfile(candidate):
        candidates += [candidate]
    candidate = os.path.normpath('/%s/%s/%s' % (prefix, app_name, confname))
    if os.path.isfile(candidate):
        candidates += [candidate]
    candidate = os.path.normpath(os.path.join(os.getcwd(), confname))
    if os.path.isfile(candidate):
        candidates += [candidate]
    if candidates:
        if verbose:
            LOGGER.info("config loaded from '%s'", candidates[0])
        return candidates[0]
    else:
        LOGGER.warning("config '%s' was not found.", confname)
    return None
173508
def load_config(path):
    
    path = os.path.abspath(path)
    if os.path.isdir(path):
        config, wordlists = _load_data(path)
    elif os.path.isfile(path):
        config = _load_config(path)
        wordlists = {}
    else:
        raise InitializationError('File or directory not found: {0}'.format(path))
    for name, wordlist in wordlists.items():
        if name in config:
            raise InitializationError("Conflict: list {!r} is defined both in config "
                                      "and in *.txt file. If it's a {!r} list, "
                                      "you should remove it from config."
                                      .format(name, _CONF.TYPE.WORDS))
        config[name] = wordlist
    return config
336028
function resolveSSLOptions(options) {
    var toReturn = _.clone(options);
    //Resolve the file-based properties
    _.forEach(_.keys(toReturn), function(key) {
        if (key === 'cert' || key === 'key' || key === 'pfx') {
            toReturn[key] = fs.readFileSync(path.resolve(global.__appDir, toReturn[key]));
        } else if (key === 'ca') { //this can be an array
            if (_.isArray(toReturn[key])) {
                //array
                toReturn[key] = _.map(toReturn[key], function(val) {
                    return fs.readFileSync(path.resolve(global.__appDir, val));
                });
            } else {
                //Single value
                toReturn[key] = fs.readFileSync(path.resolve(global.__appDir, toReturn[key]));
            }
        }
    });
    return toReturn;
}
483885
private String resolvePathVariables(String inputPath) {
        if (PathUtil.containsSymbol(inputPath)) {
            return locationService.resolveString(inputPath);
        } else {
            return inputPath;
        }
    }
1098228
function loadConfig(configPath) {
	return new Promise((resolve, reject) => {
		configPath = resolveConfigPath(configPath);
		let config;
		try {
			config = loadLocalConfigUnmodified(configPath);
			if (!config) {
				config = loadLocalConfigWithJs(configPath);
			}
			if (!config) {
				config = loadLocalConfigWithJson(configPath);
			}
			if (program.config && !config) {
				return reject(new Error(`The config file "${configPath}" could not be loaded`));
			}
		} catch (error) {
			return reject(
				new Error(`There was a problem loading "${configPath}":\n${error.stack}`)
			);
		}

		// Allow loaded configs to return a promise
		Promise.resolve(config).then(config => {
			resolve(defaultConfig(config || {}));
		});
	});
}
194383
function config_resolve({context}) {
    return () => {
        let config_part = {
            /*
            resolveLoader: {modules: [
             // __dirname+'/',
                pathModule.join(__dirname, "../node_modules"),
            ]},
            */
            context,
        };
        const extra_paths = (process.env['NODE_PATH']||'').split(':').filter(Boolean);
        if( extra_paths.length > 0 ) {
            config_part = {
                ...config_part,
                resolve: {modules: [
                    "node_modules",
                    ...extra_paths,
                ]},
            };
        }
        return config_part;
    };
}
24683
def load_config path
      return {} unless File.exist? path
      YAML.load File.read path
    end
95265
function View_resolve(toPath, fromPath) {
            var file = di.normalizePath(toPath),
                themes = this.config.themes.slice(),
                theme,
                re,
                filePath,
                normalizers = this.normalizers.slice(),
                isNormalized = false,
                path,
                pathRegex,
                pathReplace,
                trace = [];

            // file name normalizers
            while (normalizers.length) {
                path = di.normalizePath(normalizers.shift());
                pathReplace = path.replace(/\\/g, '\\\\');
                pathRegex = new RegExp(pathReplace);
                if (file.match(pathRegex)) {
                    file = file.replace(pathRegex, '').replace(this.suffix, '');
                    isNormalized = true;
                    break;
                }
            }
            // try normalize fromPath
            if (!isNormalized && !!fromPath) {
                normalizers = this.normalizers.slice();
                fromPath = di.normalizePath(fromPath);
                // file name normalizers
                while (normalizers.length) {
                    path = di.normalizePath(normalizers.shift());
                    pathReplace = path.replace(/\\/g, '\\\\');
                    pathRegex = new RegExp(pathReplace);
                    if (fromPath.match(pathRegex)) {
                        isNormalized = true;
                        break;
                    }
                }
            }

            // check themes
            if (isNormalized) {
                while (themes.length) {
                    theme = di.normalizePath(themes.shift() + '/');
                    pathReplace = theme.replace(/\\/g, '\\\\');
                    re = new RegExp('^' + pathReplace);
                    file = file.replace(re, '');

                    filePath = di.normalizePath(path + theme + '/' + file + this.config.suffix);
                    if (this.isFile(filePath)) {
                        return filePath;
                    }
                    trace.push({
                        theme: theme,
                        path: path,
                        filePath: filePath
                    });
                }
            }


            throw new error.HttpError(500, {
                from: fromPath,
                load: toPath,
                filePath: filePath,
                paths: this.paths,
                isNormalized: isNormalized,
                file: file,
                path: path,
                trace: trace,
                themes: this.config.themes
            }, "View.resolve: template don't exists");
        }
1054561
def load_config(path=None):
    """"""
    if not path or not op.exists(path):
        return Config()
    path = op.realpath(path)
    dirpath, filename = op.split(path)
    file_ext = op.splitext(path)[1]
    logger.debug("Load config file `%s`.", path)
    if file_ext == '.py':
        config = PyFileConfigLoader(filename, dirpath,
                                    log=logger).load_config()
    elif file_ext == '.json':
        config = JSONFileConfigLoader(filename, dirpath,
                                      log=logger).load_config()
    return config
493964
def resolve_path(path):
    """"""
    if path[0] == '~':
        # ~ or ~user
        path = os.path.expanduser(path)
    if path[0] != '/':
        # Relative path
        if cur_dir[-1] == '/':
            path = cur_dir + path
        else:
            path = cur_dir + '/' + path
    comps = path.split('/')
    new_comps = []
    for comp in comps:
        # We strip out xxx/./xxx and xxx//xxx, except that we want to keep the
        # leading / for absolute paths. This also removes the trailing slash
        # that autocompletion adds to a directory.
        if comp == '.' or (comp == '' and len(new_comps) > 0):
            continue
        if comp == '..':
            if len(new_comps) > 1:
                new_comps.pop()
        else:
            new_comps.append(comp)
    if len(new_comps) == 1 and new_comps[0] == '':
        return '/'
    return '/'.join(new_comps)
275984
def look_up_configured_path(path_type, options = {})
      return @cached_paths[path_type] if @cached_paths.has_key?(path_type)
      if user_defined_path = user_configured_path(path_type)
        if path_resolves?(user_defined_path, :file => options[:file])
          return user_defined_path
        else
          raise Bumbleworks::InvalidSetting, "#{Bumbleworks::Support.humanize(path_type)} not found (looked for #{user_defined_path || defaults.join(', ')})"
        end
      end

      first_existing_default_path(options[:defaults], :file => options[:file])
    end
251861
function loadConfigFile(configPath) {
	logger.debug('Loading configuration file at:', configPath);

	function loadConfig() {
		return fs.readFileSync(configPath, { encoding: 'utf8' });
	}

	function parseConfig(content, extension) {
		switch (extension) {
		case '.js':
			return require(configPath);

		case '.yaml':
			return jsYaml.safeLoad(content, { filename: configPath });

		case '.json':
			try {
				return JSON.parse(content);
			} catch (error) {
				// Try to provide more specific syntax errors
				lintJson(content);

				// If no syntax errors are found, throw a generic error
				throw new Error('There was a problem loading a configuration file: ' + configPath);
			}

		case '.json5':
			return JSON5.parse(content);

		default:
			throw new Error(`Configuration file is an unsupported type [${supportedTypes.join(', ')}]: ` + configPath);
		}
	}

	var extension = path.extname(configPath);
	var content;

	try {
		content = loadConfig();
	} catch (error) {
		throw new ConfigurationError('Failed to read configuration file', configPath, error);
	}

	try {
		return parseConfig(content, extension);
	} catch (error) {
		throw new ConfigurationError('Failed to parse configuration file', configPath, error);
	}
}
1331913
function loadConfig(path) {
  try {
    var configJSON = JSON.parse(fs.readFileSync(process.cwd() + "/" + path));
    console.log("Config file detected: " + path)
    return configJSON;
  }
  catch(e) {
    console.log("Config file: " + e.toString())
  }
}
1057031
def _resolve_path(self, path):
        
        filepath = None
        mimetype = None

        for root, dirs, files in self.filter_files(self.path):
            # Does it exist in error path?
            error_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'error_templates', path)
            try:
                with open(error_path):
                    mimetype, encoding = mimetypes.guess_type(error_path)
                    filepath = error_path
            except IOError:
                pass

            # Does it exist in Tarbell blueprint?
            if self.base:
                basepath = os.path.join(root, self.blueprint_name, path)
                try:
                    with open(basepath):
                        mimetype, encoding = mimetypes.guess_type(basepath)
                        filepath = basepath
                except IOError:
                    pass

            # Does it exist under regular path?
            fullpath = os.path.join(root, path)
            try:
                with open(fullpath):
                    mimetype, encoding = mimetypes.guess_type(fullpath)
                    filepath = fullpath
            except IOError:
                pass

        return filepath, mimetype
616729
function lookupFile(conf, fileRelative) {
  const relativeToFile = path.resolve(conf.filepath, fileRelative);
  if (layoutHelper.store.exist(relativeToFile)) {
    return relativeToFile;
  }

  if (conf.settings && conf.settings.views) {
    if (!Array.isArray(conf.settings.views)) {
      const fromView = path.resolve(conf.settings.views, fileRelative);
      if (layoutHelper.store.exist(fromView)) {
        return fromView;
      }
    }

    for (let i = 0; i < conf.settings.views.length; i += 1) {
      const fromView = path.resolve(conf.settings.views[i], fileRelative);
      if (layoutHelper.store.exist(fromView)) {
        return fromView;
      }
    }
  }

  return relativeToFile;
}
359294
function resolveImportPaths(filePath, importPaths){
  var dir = path.dirname(filePath);
  return importPaths.map(function(relativePath){
    if(!path.extname(relativePath)){
      relativePath += '.less';
    }
    return path.resolve(dir, relativePath);
  });
}