MCPcopy
hub / github.com/perkeep/perkeep / perkeepConfigDir

Function perkeepConfigDir

internal/osutil/paths.go:176–192  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

174}
175
176func perkeepConfigDir() (string, error) {
177 oldName := configDirNamed("camlistore")
178 newName := configDirNamed("perkeep")
179 if fi, err := os.Lstat(oldName); err == nil && fi.IsDir() && oldName != newName {
180 n, err := numRegularFilesUnder(oldName)
181 if err != nil {
182 return "", fmt.Errorf("error enumerating old directory %s: %w", oldName, err)
183 }
184 if n == 0 {
185 log.Printf("removing old, empty config dir %s", oldName)
186 os.RemoveAll(oldName)
187 } else {
188 return "", fmt.Errorf("Error: old configuration directory detected. Not running until it's moved.\nRename %s to %s\n", oldName, newName)
189 }
190 }
191 return newName, nil
192}
193
194var configDirNamedTestHook func(string) string
195

Callers 3

PerkeepConfigDirFunction · 0.85
DefaultSecretRingFileFunction · 0.85
TestCamPkConfigMigrationFunction · 0.85

Calls 5

configDirNamedFunction · 0.85
numRegularFilesUnderFunction · 0.85
PrintfMethod · 0.80
LstatMethod · 0.65
IsDirMethod · 0.65

Tested by 1

TestCamPkConfigMigrationFunction · 0.68