From e3761fa47fff16b040ad7fb9b99edb1b4a688836 Mon Sep 17 00:00:00 2001 From: Unknown Date: Tue, 3 Dec 2013 02:56:07 -0500 Subject: [PATCH] Bug fixed --- cmd/bin.go | 2 +- cmd/build.go | 13 ++++++++++++- cmd/gopath.go | 2 ++ cmd/helper_windows.go | 1 + 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/cmd/bin.go b/cmd/bin.go index 16f25c003..9396bdcb8 100644 --- a/cmd/bin.go +++ b/cmd/bin.go @@ -152,7 +152,7 @@ func runBin(ctx *cli.Context) { if ctx.Bool("dir") { movePath = ctx.Args()[1] } - _, err = com.Move(binPath, movePath+"/"+binName) + err = os.Rename(binPath, movePath+"/"+binName) if err != nil { log.Error("Bin", "Fail to move binary") log.Fatal("", err.Error()) diff --git a/cmd/build.go b/cmd/build.go index bdb763238..8d3706008 100644 --- a/cmd/build.go +++ b/cmd/build.go @@ -15,7 +15,8 @@ package cmd import ( - //"os" + "os" + "path" "github.com/codegangsta/cli" @@ -47,5 +48,15 @@ func runBuild(ctx *cli.Context) { log.Fatal("", err.Error()) } + if isWindowsXP { + binName := pkgName + ".exe" + os.Remove(binName) + err = os.Rename(path.Join(VENDOR, "src", pkgName, binName), binName) + if err != nil { + log.Error("Build", "Fail to move binary") + log.Fatal("", err.Error()) + } + } + log.Success("SUCC", "Build", "Command execute successfully!") } diff --git a/cmd/gopath.go b/cmd/gopath.go index 47a6c6f50..7d2159b4c 100644 --- a/cmd/gopath.go +++ b/cmd/gopath.go @@ -17,6 +17,8 @@ import ( const VENDOR = ".vendor" +var isWindowsXP = false + func getGopmPkgs(dirPath string, isTest bool) (pkgs map[string]*doc.Pkg, err error) { absPath, err := filepath.Abs(dirPath) if err != nil { diff --git a/cmd/helper_windows.go b/cmd/helper_windows.go index efdd29f6d..109aa9c89 100644 --- a/cmd/helper_windows.go +++ b/cmd/helper_windows.go @@ -16,6 +16,7 @@ func makeLink(srcPath, destPath string) error { } // XP. + isWindowsXP = true os.RemoveAll(destPath) return com.CopyDir(srcPath, destPath) }