1
0
Fork 0

Migrate from libkv to valkeyrie library

This commit is contained in:
NicoMen 2018-01-24 17:52:03 +01:00 committed by Traefiker
parent a91080b060
commit 563a0bd274
33 changed files with 109 additions and 115 deletions

View file

@ -105,14 +105,8 @@ func (ts *TomlSource) ConfigFileUsed() string {
func preprocessDir(dirIn string) (string, error) {
dirOut := dirIn
if strings.HasPrefix(dirIn, "$") {
end := strings.Index(dirIn, string(os.PathSeparator))
if end == -1 {
end = len(dirIn)
}
dirOut = os.Getenv(dirIn[1:end]) + dirIn[end:]
}
dirOut, err := filepath.Abs(dirOut)
expanded := os.ExpandEnv(dirIn)
dirOut, err := filepath.Abs(expanded)
return dirOut, err
}
@ -123,7 +117,8 @@ func findFile(filename string, dirNfile []string) string {
if fileInfo, err := os.Stat(fullPath); err == nil && !fileInfo.IsDir() {
return fullPath
}
fullPath = fullPath + "/" + filename + ".toml"
fullPath = filepath.Join(fullPath, filename+".toml")
if fileInfo, err := os.Stat(fullPath); err == nil && !fileInfo.IsDir() {
return fullPath
}