mirror of
https://github.com/spf13/viper
synced 2024-12-22 19:47:01 +00:00
Fixes #1062
This commit is contained in:
parent
e606f7496e
commit
46a61e6fbd
1 changed files with 1 additions and 13 deletions
14
util.go
14
util.go
|
@ -95,19 +95,7 @@ func absPathify(inPath string) string {
|
|||
inPath = userHomeDir() + inPath[5:]
|
||||
}
|
||||
|
||||
if strings.HasPrefix(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
|
||||
}
|
||||
inPath = os.ExpandEnv(inPath)
|
||||
|
||||
if filepath.IsAbs(inPath) {
|
||||
return filepath.Clean(inPath)
|
||||
|
|
Loading…
Reference in a new issue