MCPcopy Index your code
hub / github.com/dnote/dnote / FileExists

Function FileExists

pkg/cli/utils/files.go:43–53  ·  view source on GitHub ↗

FileExists checks if the file exists at the given path

(filepath string)

Source from the content-addressed store, hash-verified

41
42// FileExists checks if the file exists at the given path
43func FileExists(filepath string) (bool, error) {
44 _, err := os.Stat(filepath)
45 if err == nil {
46 return true, nil
47 }
48 if os.IsNotExist(err) {
49 return false, nil
50 }
51
52 return false, errors.Wrap(err, "getting file info")
53}
54
55// EnsureDir creates a directory if it doesn't exist.
56// Returns nil if the directory already exists or was successfully created.

Callers 12

TestInitFunction · 0.92
TestDBPathFlagFunction · 0.92
checkLegacyDBPathFunction · 0.92
initConfigFileFunction · 0.92
LegacyFunction · 0.92
migrateToV1Function · 0.92
TestMigrateToV1Function · 0.92
TestMigrateToV8Function · 0.92
GetTmpContentPathFunction · 0.92
GetEditorInputFunction · 0.92
checkLegacyPathFunction · 0.92
EnsureDirFunction · 0.85

Calls

no outgoing calls

Tested by 4

TestInitFunction · 0.74
TestDBPathFlagFunction · 0.74
TestMigrateToV1Function · 0.74
TestMigrateToV8Function · 0.74