MCPcopy
hub / github.com/EngoEngine/engo / load

Method load

assets.go:87–105  ·  view source on GitHub ↗

load loads the given resource into memory.

(url string)

Source from the content-addressed store, hash-verified

85
86// load loads the given resource into memory.
87func (formats *Formats) load(url string) error {
88 ext := getExt(url)
89 if loader, ok := Files.formats[ext]; ok {
90 f, err := openFile(filepath.Join(formats.root, url))
91 if err != nil {
92 return fmt.Errorf("unable to open resource: %s", err)
93 }
94 defer f.Close()
95
96 // This specific loader needs to be given the root
97 rl, ok := loader.(FileLoaderRooter)
98 if ok {
99 rl.SetRoot(formats.GetRoot())
100 }
101
102 return loader.Load(url, f)
103 }
104 return fmt.Errorf("no `FileLoader` associated with this extension: %q in url %q", ext, url)
105}
106
107// Load loads the given resource(s) into memory, stopping at the first error.
108func (formats *Formats) Load(urls ...string) error {

Callers 1

LoadMethod · 0.95

Calls 6

GetRootMethod · 0.95
getExtFunction · 0.70
openFileFunction · 0.70
CloseMethod · 0.65
SetRootMethod · 0.65
LoadMethod · 0.65

Tested by

no test coverage detected