summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/spf13/viper/util.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2020-09-04 23:29:13 +0200
committerGitHub <noreply@github.com>2020-09-04 23:29:13 +0200
commit2f59abdda7a1072036ea1fdb4c859cccbb56efa6 (patch)
treee35393f23d12783ae92f0469085efc7dec953f82 /vendor/github.com/spf13/viper/util.go
parent17747a5c8893fd47ba8eb61dd10477170640caf6 (diff)
downloadmatterbridge-msglm-2f59abdda7a1072036ea1fdb4c859cccbb56efa6.tar.gz
matterbridge-msglm-2f59abdda7a1072036ea1fdb4c859cccbb56efa6.tar.bz2
matterbridge-msglm-2f59abdda7a1072036ea1fdb4c859cccbb56efa6.zip
Update vendor (#1228)
Diffstat (limited to 'vendor/github.com/spf13/viper/util.go')
-rw-r--r--vendor/github.com/spf13/viper/util.go13
1 files changed, 11 insertions, 2 deletions
diff --git a/vendor/github.com/spf13/viper/util.go b/vendor/github.com/spf13/viper/util.go
index b7889696..cee6b242 100644
--- a/vendor/github.com/spf13/viper/util.go
+++ b/vendor/github.com/spf13/viper/util.go
@@ -91,13 +91,22 @@ func insensitiviseMap(m map[string]interface{}) {
func absPathify(inPath string) string {
jww.INFO.Println("Trying to resolve absolute path to", inPath)
- if strings.HasPrefix(inPath, "$HOME") {
+ if inPath == "$HOME" || strings.HasPrefix(inPath, "$HOME"+string(os.PathSeparator)) {
inPath = userHomeDir() + inPath[5:]
}
if strings.HasPrefix(inPath, "$") {
end := strings.Index(inPath, string(os.PathSeparator))
- inPath = os.Getenv(inPath[1:end]) + inPath[end:]
+
+ 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) {