mirror of https://github.com/spf13/viper.git
Fixes #1062
This commit is contained in:
parent
e606f7496e
commit
46a61e6fbd
14
util.go
14
util.go
|
@ -95,19 +95,7 @@ func absPathify(inPath string) string {
|
||||||
inPath = userHomeDir() + inPath[5:]
|
inPath = userHomeDir() + inPath[5:]
|
||||||
}
|
}
|
||||||
|
|
||||||
if strings.HasPrefix(inPath, "$") {
|
inPath = os.ExpandEnv(inPath)
|
||||||
end := strings.Index(inPath, string(os.PathSeparator))
|
|
||||||
|
|
||||||
var value, suffix string
|
|
||||||
if end == -1 {
|
|
||||||
value = os.Getenv(inPath[1:])
|
|
||||||
} else {
|
|
||||||
value = os.Getenv(inPath[1:end])
|
|
||||||
suffix = inPath[end:]
|
|
||||||
}
|
|
||||||
|
|
||||||
inPath = value + suffix
|
|
||||||
}
|
|
||||||
|
|
||||||
if filepath.IsAbs(inPath) {
|
if filepath.IsAbs(inPath) {
|
||||||
return filepath.Clean(inPath)
|
return filepath.Clean(inPath)
|
||||||
|
|
Loading…
Reference in New Issue