MCPcopy Create free account
hub / github.com/ddev/ddev / FileIsReadable

Function FileIsReadable

pkg/fileutil/files.go:136–143  ·  view source on GitHub ↗

FileIsReadable checks to make sure a file exists and is readable

(name string)

Source from the content-addressed store, hash-verified

134
135// FileIsReadable checks to make sure a file exists and is readable
136func FileIsReadable(name string) bool {
137 file, err := os.OpenFile(name, os.O_RDONLY, 0666)
138 if err != nil {
139 return false
140 }
141 file.Close()
142 return true
143}
144
145// PurgeDirectory removes all of the contents of a given
146// directory, leaving the directory itself intact.

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected