Browse Source

Fixed bug in XP

pull/103/head
Unknown 11 years ago
parent
commit
a4df5e1493
  1. 14
      cmd/bin.go
  2. 2
      gopm.go

14
cmd/bin.go

@ -145,14 +145,14 @@ func runBin(ctx *cli.Context) {
_, pkgName = filepath.Split(pkgPath) _, pkgName = filepath.Split(pkgPath)
} }
// Because build command moved binary to root path.
binName := path.Base(pkgName) binName := path.Base(pkgName)
if runtime.GOOS == "windows" { if runtime.GOOS == "windows" {
binName += ".exe" binName += ".exe"
} }
binPath := path.Join(doc.VENDOR, "src", pkgName, binName) if !com.IsFile(binName) {
if !com.IsFile(binPath) {
log.Error("bin", "Binary does not exist:") log.Error("bin", "Binary does not exist:")
log.Error("", "\t"+binPath) log.Error("", "\t"+binName)
log.Fatal("", "\tPrevious steps weren't successful or the project does not contain main package") log.Fatal("", "\tPrevious steps weren't successful or the project does not contain main package")
} }
@ -161,8 +161,12 @@ func runBin(ctx *cli.Context) {
if ctx.Bool("dir") { if ctx.Bool("dir") {
movePath = ctx.Args()[1] movePath = ctx.Args()[1]
} }
os.Remove(movePath + "/" + binName) err = os.Remove(movePath + "/" + binName)
err = os.Rename(binPath, movePath+"/"+binName) if err != nil {
log.Warn("Cannot remove binary in work directory:")
log.Warn("\t %s", err)
}
err = os.Rename(binName, movePath+"/"+binName)
if err != nil { if err != nil {
log.Error("bin", "Fail to move binary:") log.Error("bin", "Fail to move binary:")
log.Fatal("", "\t"+err.Error()) log.Fatal("", "\t"+err.Error())

2
gopm.go

@ -29,7 +29,7 @@ import (
// Test that go1.1 tag above is included in builds. main.go refers to this definition. // Test that go1.1 tag above is included in builds. main.go refers to this definition.
const go11tag = true const go11tag = true
const APP_VER = "0.5.7.1205" const APP_VER = "0.5.7.1205.1"
// //cmd.CmdSearch, // //cmd.CmdSearch,
// cmdClean, // cmdClean,

Loading…
Cancel
Save