aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/utils/customflags.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/utils/customflags.go')
-rw-r--r--cmd/utils/customflags.go9
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))
}