fix user home directory for linux to work on both ubuntu and centos, without loosing cross-compilation support
This commit is contained in:
parent
5c5281683f
commit
551e3f029a
1
go.mod
1
go.mod
|
@ -9,6 +9,7 @@ require (
|
|||
github.com/lunixbochs/vtclean v1.0.0
|
||||
github.com/mattn/go-runewidth v0.0.4
|
||||
github.com/mbndr/figlet4go v0.0.0-20190224160619-d6cef5b186ea
|
||||
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
||||
github.com/mitchellh/go-wordwrap v1.0.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.0-20190709130402-674ba3eaed22
|
||||
)
|
||||
|
|
2
go.sum
2
go.sum
|
@ -23,6 +23,8 @@ github.com/mattn/go-runewidth v0.0.4 h1:2BvfKmzob6Bmd4YsL0zygOqfdFnK7GR4QL06Do4/
|
|||
github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
|
||||
github.com/mbndr/figlet4go v0.0.0-20190224160619-d6cef5b186ea h1:mQncVDBpKkAecPcH2IMGpKUQYhwowlafQbfkz2QFqkc=
|
||||
github.com/mbndr/figlet4go v0.0.0-20190224160619-d6cef5b186ea/go.mod h1:QzTGLGoOqLHUBK8/EZ0v4Fa4CdyXmdyRwCHcl0YbeO4=
|
||||
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
|
||||
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
|
||||
github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo=
|
||||
github.com/mitchellh/go-wordwrap v1.0.0 h1:6GlHJ/LTGMrIJbwgdqdl2eEH8o+Exx/0m8ir9Gns0u4=
|
||||
github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo=
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package metadata
|
||||
|
||||
import (
|
||||
"github.com/mitchellh/go-homedir"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
|
@ -28,7 +29,7 @@ func getPlatformStoragePath(filename string) string {
|
|||
cache, _ := os.UserCacheDir()
|
||||
return filepath.Join(cache, windowsDir, filename)
|
||||
default:
|
||||
home, _ := os.UserHomeDir()
|
||||
home, _ := homedir.Dir()
|
||||
return filepath.Join(home, linuxDir, filename)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue