MCPcopy
hub / github.com/filebrowser/filebrowser / dbExists

Function dbExists

cmd/utils.go:50–68  ·  view source on GitHub ↗
(path string)

Source from the content-addressed store, hash-verified

48}
49
50func dbExists(path string) (bool, error) {
51 stat, err := os.Stat(path)
52 if err == nil {
53 return stat.Size() != 0, nil
54 }
55
56 if os.IsNotExist(err) {
57 d := filepath.Dir(path)
58 _, err = os.Stat(d)
59 if os.IsNotExist(err) {
60 if err := os.MkdirAll(d, 0700); err != nil {
61 return false, err
62 }
63 return false, nil
64 }
65 }
66
67 return false, err
68}
69
70// Generate the replacements for all environment variables. This allows to
71// use FB_BRANDING_DISABLE_EXTERNAL environment variables, even when the

Callers 1

withViperAndStoreFunction · 0.85

Calls 2

MkdirAllMethod · 0.80
StatMethod · 0.45

Tested by

no test coverage detected