fix: updated islazy to 1.10.3 (ref #481)

This commit is contained in:
evilsocket 2019-03-13 06:12:09 +01:00
parent 852abec22e
commit 603735adb6
No known key found for this signature in database
GPG key ID: 1564D7F30393A456
2 changed files with 12 additions and 8 deletions

6
Gopkg.lock generated
View file

@ -83,7 +83,7 @@
revision = "2ce16c963a8ac5bd6af851d4877e38701346983f"
[[projects]]
digest = "1:a5fab5a807cac4da733996f46b917283fe43aac5fd32798a3c9279a44eb5156c"
digest = "1:da1be9af4c3f262bd385cc722b08d98d4a47ddea57731e98b85c7ba21b35bc31"
name = "github.com/evilsocket/islazy"
packages = [
"data",
@ -96,8 +96,8 @@
"zip",
]
pruneopts = "UT"
revision = "e6f5e33089826f0d17eaab3c8c3603048d615a0e"
version = "v1.10.2"
revision = "6ef79e84ded205e48f296d21e3bc65d1cf4f5c78"
version = "v1.10.3"
[[projects]]
branch = "master"

View file

@ -12,16 +12,20 @@ var (
cwdLock = sync.Mutex{}
)
// Expand will expand a path with ~ to a full path of the current user.
// Expand will expand a path with ~ to the $HOME of the current user.
func Expand(path string) (string, error) {
if path == "" {
return path, nil
}
usr, err := user.Current()
if err != nil {
return "", err
home := os.Getenv("HOME")
if home == "" {
usr, err := user.Current()
if err != nil {
return "", err
}
home = usr.HomeDir
}
return filepath.Abs(strings.Replace(path, "~", usr.HomeDir, 1))
return filepath.Abs(strings.Replace(path, "~", home, 1))
}
// Exists returns true if the path exists.