MCPcopy
hub / github.com/cloudflare/cloudflared / FileExists

Function FileExists

config/configuration.go:89–100  ·  view source on GitHub ↗

FileExists checks to see if a file exist at the provided path.

(path string)

Source from the content-addressed store, hash-verified

87
88// FileExists checks to see if a file exist at the provided path.
89func FileExists(path string) (bool, error) {
90 f, err := os.Open(path)
91 if err != nil {
92 if os.IsNotExist(err) {
93 // ignore missing files
94 return false, nil
95 }
96 return false, err
97 }
98 _ = f.Close()
99 return true, nil
100}
101
102// FindDefaultConfigPath returns the first path that contains a config file.
103// If none of the combination of DefaultConfigSearchDirectories() and DefaultConfigFiles

Callers 8

TestCertGenSuccessFunction · 0.92
generateKeyPairFunction · 0.92
getConfigPathFunction · 0.92
buildArgsForConfigFunction · 0.92
ensureConfigDirExistsFunction · 0.92
checkForExistingCertFunction · 0.92
FindDefaultConfigPathFunction · 0.85

Calls 1

CloseMethod · 0.65

Tested by 1

TestCertGenSuccessFunction · 0.74