diff options
author | Felix Lange <fjl@twurst.com> | 2015-08-06 22:18:32 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2015-08-06 23:18:59 +0800 |
commit | eae1191904fd739cdffdd2903509a44a35c4c2f2 (patch) | |
tree | f10fc9132fabdeada3c8a0f4e2558f3d20c096af /cmd/utils/customflags.go | |
parent | 78b101e15d4a92d9f0f1d9ca49e45d5699adb3d2 (diff) | |
download | dexon-eae1191904fd739cdffdd2903509a44a35c4c2f2.tar dexon-eae1191904fd739cdffdd2903509a44a35c4c2f2.tar.gz dexon-eae1191904fd739cdffdd2903509a44a35c4c2f2.tar.bz2 dexon-eae1191904fd739cdffdd2903509a44a35c4c2f2.tar.lz dexon-eae1191904fd739cdffdd2903509a44a35c4c2f2.tar.xz dexon-eae1191904fd739cdffdd2903509a44a35c4c2f2.tar.zst dexon-eae1191904fd739cdffdd2903509a44a35c4c2f2.zip |
cmd/utils: fix path expansion on windows
Diffstat (limited to 'cmd/utils/customflags.go')
-rw-r--r-- | cmd/utils/customflags.go | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/cmd/utils/customflags.go b/cmd/utils/customflags.go index e7efed4e3..4450065c1 100644 --- a/cmd/utils/customflags.go +++ b/cmd/utils/customflags.go @@ -21,7 +21,7 @@ import ( "fmt" "os" "os/user" - "path/filepath" + "path" "strings" "github.com/codegangsta/cli" @@ -138,11 +138,8 @@ func (self *DirectoryFlag) Set(value string) { func expandPath(p string) string { if strings.HasPrefix(p, "~/") || strings.HasPrefix(p, "~\\") { if user, err := user.Current(); err == nil { - if err == nil { - p = strings.Replace(p, "~", user.HomeDir, 1) - } + p = user.HomeDir + p[1:] } } - - return filepath.Clean(os.ExpandEnv(p)) + return path.Clean(os.ExpandEnv(p)) } |