MCPcopy
hub / github.com/caddyserver/caddy / funcFileExists

Method funcFileExists

modules/caddyhttp/templates/tplcontext.go:426–436  ·  view source on GitHub ↗

funcFileExists returns true if filename can be opened successfully.

(filename string)

Source from the content-addressed store, hash-verified

424
425// funcFileExists returns true if filename can be opened successfully.
426func (c TemplateContext) funcFileExists(filename string) (bool, error) {
427 if c.Root == nil {
428 return false, fmt.Errorf("root file system not specified")
429 }
430 file, err := c.Root.Open(filename)
431 if err == nil {
432 file.Close()
433 return true, nil
434 }
435 return false, nil
436}
437
438// funcFileStat returns Stat of a filename
439func (c TemplateContext) funcFileStat(filename string) (fs.FileInfo, error) {

Callers

nothing calls this directly

Calls 2

OpenMethod · 0.80
CloseMethod · 0.45

Tested by

no test coverage detected