// LoadGopmfile loads and returns given gopmfile.
735
func LoadGopmfile(fileName string) (*goconfig.ConfigFile, error) {
	if !base.IsFile(fileName) {
		return goconfig.LoadFromData([]byte(""))
	}

	gf, err := goconfig.LoadConfigFile(fileName)
	if err != nil {
		return nil, fmt.Errorf("Fail to load gopmfile: %v", err)
	}
	return gf, nil
}
890288
func (f *File) Load() (*Config, error) {
	var err error
	if !utils.Exists(f.FilePath) {
		return nil, errors.New("Error: I Can't find the config file at [" + f.FilePath + "]")
	}

	// read file
	f.Data, err = ioutil.ReadFile(f.FilePath)
	if err != nil {
		return nil, err
	}

	// parse file
	return f.Parse()
}
100752
func LoadFile(file string) (data []byte, size int) {
	return RWFromFile(file, "rb").LoadFileRW(true)
}
193886
func (h *Hooks) LoadFromFile(path string, asTemplate bool) error {
	if path == "" {
		return nil
	}

	// parse hook file for hooks
	file, e := ioutil.ReadFile(path)

	if e != nil {
		return e
	}

	if asTemplate {
		funcMap := template.FuncMap{"getenv": getenv}

		tmpl, err := template.New("hooks").Funcs(funcMap).Parse(string(file))
		if err != nil {
			return err
		}

		var buf bytes.Buffer

		err = tmpl.Execute(&buf, nil)
		if err != nil {
			return err
		}

		file = buf.Bytes()
	}

	e = yaml.Unmarshal(file, h)
	return e
}
1176147
func LoadFile(config interface{}, file string, opts Options) error {
	return LoadFiles(config, []string{file}, opts)
}
600139
func LoadProjectConfigFromFile() (ProjectConfigModel, error) {
	projectConfigFileAbsPath, err := ProjectConfigFileAbsPath()
	if err != nil {
		return ProjectConfigModel{}, fmt.Errorf("Failed to get absolute path of project config: %s", err)
	}

	bytes, err := ioutil.ReadFile(projectConfigFileAbsPath)
	if err != nil {
		return ProjectConfigModel{}, fmt.Errorf("Failed to read project config file (%s), error: %s", projectConfigFileAbsPath, err)
	}
	var projectConfig ProjectConfigModel
	if err := yaml.Unmarshal(bytes, &projectConfig); err != nil {
		return ProjectConfigModel{}, fmt.Errorf("Failed to parse project config (should be valid YML, path: %s), error: %s", projectConfigFileAbsPath, err)
	}

	return projectConfig, nil
}
990226
func LoadFile(path string) error {
	return Load(file.NewSource(
		file.WithPath(path),
	))
}
116128
func LoadFile(path string) (*Config, error) {
	importTree, err := loadTree(path)
	if err != nil {
		return nil, err
	}

	configTree, err := importTree.ConfigTree()

	// Close the importTree now so that we can clear resources as quickly
	// as possible.
	importTree.Close()

	if err != nil {
		return nil, err
	}

	return configTree.Flatten()
}
1307609
func (ls *LState) LoadFile(path string) (*LFunction, error) {
	var file *os.File
	var err error
	if len(path) == 0 {
		file = os.Stdin
	} else {
		file, err = os.Open(path)
		defer file.Close()
		if err != nil {
			return nil, newApiErrorE(ApiErrorFile, err)
		}
	}

	reader := bufio.NewReader(file)
	// get the first character.
	c, err := reader.ReadByte()
	if err != nil && err != io.EOF {
		return nil, newApiErrorE(ApiErrorFile, err)
	}
	if c == byte('#') {
		// Unix exec. file?
		// skip first line
		_, err, _ = readBufioLine(reader)
		if err != nil {
			return nil, newApiErrorE(ApiErrorFile, err)
		}
	}

	if err != io.EOF {
		// if the file is not empty,
		// unread the first character of the file or newline character(readBufioLine's last byte).
		err = reader.UnreadByte()
		if err != nil {
			return nil, newApiErrorE(ApiErrorFile, err)
		}
	}

	return ls.Load(reader, path)
}
820450
func LoadCertFromFile(filename string) (*x509.Certificate, error) {
	certs, err := LoadCertBundleFromFile(filename)
	if err != nil {
		return nil, err
	}
	return certs[0], nil
}
44103
func LoadFromFile(filename string) (config Config, err error) {
	var f *os.File
	if f, err = os.Open(filename); err != nil { // nolint: gosec
		err = fmt.Errorf("failed to load IAM config from file %q: %+v", filename, err)
		return
	}

	defer errorutil.Ignore(f.Close)
	dec := json.NewDecoder(f)
	if err = dec.Decode(&config); err != nil {
		err = fmt.Errorf("invalid IAM JSON: %+v", err)
		return
	}
	if _, err = url.Parse(config.LoginEndpoint); err != nil {
		err = fmt.Errorf("invalid LoginEndpoint URL: %+v", err)
	}
	return
}
910893
func LoadConfigFile(path string, logger log.Logger) (*Config, error) {
	// Read the file
	d, err := ioutil.ReadFile(path)
	if err != nil {
		return nil, err
	}
	return ParseConfig(string(d), logger)
}
1043053
func LoadConf(file string) (*Config, error) {
	config := &Config{}
	if file == "" {
		return config, nil
	}
	f, err := os.Open(file)
	if err != nil {
		return nil, fmt.Errorf("could not open config file %q: %v", file, err)
	}
	defer f.Close()

	dec := json.NewDecoder(f)
	err = dec.Decode(config)
	if err != nil {
		return nil, fmt.Errorf("could not parse config file %q: %v", file, err)
	}
	return config, nil
}
601570
func LoadTGARW(src *sdl.RWops) (*sdl.Surface, error) {
	_src := (*C.SDL_RWops)(unsafe.Pointer(src))
	_surface := C.IMG_LoadTGA_RW(_src)
	if _surface == nil {
		return nil, GetError()
	}
	return (*sdl.Surface)(unsafe.Pointer(_surface)), nil
}
49338
func LoadPEMPrivKeyFile(name string) (*rsa.PrivateKey, error) {
	file, err := os.Open(name)
	if err != nil {
		return nil, err
	}
	defer file.Close()

	return LoadPEMPrivKey(file)
}
595020
func LoadFiles(config interface{}, files []string, opts Options) error {
	if len(files) == 0 {
		return errNoFilesToLoad
	}
	for _, name := range files {
		data, err := ioutil.ReadFile(name)
		if err != nil {
			return err
		}
		unmarshal := yaml.UnmarshalStrict
		if opts.DisableUnmarshalStrict {
			unmarshal = yaml.Unmarshal
		}
		if err := unmarshal(data, config); err != nil {
			return err
		}
	}
	if opts.DisableValidate {
		return nil
	}
	return validator.Validate(config)
}
1130601
func loadFileContent(v string) ([]byte, error) {
	filename, err := homedir.Expand(v)
	if err != nil {
		return nil, err
	}
	fileContent, err := ioutil.ReadFile(filename)
	if err != nil {
		return nil, err
	}
	return fileContent, nil
}