Browse Source

Fixed bug ~

pull/103/head
Unknown 11 years ago
parent
commit
ef09484a3b
  1. 8
      cmd/bin.go
  2. 5
      cmd/build.go
  3. 7
      cmd/get.go
  4. 10
      doc/conf.go

8
cmd/bin.go

@ -49,13 +49,6 @@ func runBin(ctx *cli.Context) {
log.Fatal("", "No package specified") log.Fatal("", "No package specified")
} }
hd, err := com.HomeDir()
if err != nil {
log.Error("Bin", "Fail to get current user")
log.Fatal("", err.Error())
}
doc.HomeDir = strings.Replace(doc.RawHomeDir, "~", hd, -1)
doc.LoadPkgNameList(doc.HomeDir + "/data/pkgname.list") doc.LoadPkgNameList(doc.HomeDir + "/data/pkgname.list")
installRepoPath = doc.HomeDir + "/repos" installRepoPath = doc.HomeDir + "/repos"
@ -80,6 +73,7 @@ func runBin(ctx *cli.Context) {
info := ctx.Args()[0] info := ctx.Args()[0]
pkgName := info pkgName := info
ver := "" ver := ""
var err error
if i := strings.Index(info, "@"); i > -1 { if i := strings.Index(info, "@"); i > -1 {
pkgName = info[:i] pkgName = info[:i]
_, ver, err = validPath(info[i+1:]) _, ver, err = validPath(info[i+1:])

5
cmd/build.go

@ -15,7 +15,7 @@
package cmd package cmd
import ( import (
"os" //"os"
"github.com/codegangsta/cli" "github.com/codegangsta/cli"
@ -47,8 +47,5 @@ func runBuild(ctx *cli.Context) {
log.Fatal("", err.Error()) log.Fatal("", err.Error())
} }
// I don't know why, but there is a folder named "~".
os.RemoveAll("~")
log.Success("SUCC", "Build", "Command execute successfully!") log.Success("SUCC", "Build", "Command execute successfully!")
} }

7
cmd/get.go

@ -62,13 +62,6 @@ func init() {
} }
func runGet(ctx *cli.Context) { func runGet(ctx *cli.Context) {
hd, err := com.HomeDir()
if err != nil {
log.Error("Get", "Fail to get current user")
log.Fatal("", err.Error())
}
doc.HomeDir = strings.Replace(doc.RawHomeDir, "~", hd, -1)
doc.LoadPkgNameList(doc.HomeDir + "/data/pkgname.list") doc.LoadPkgNameList(doc.HomeDir + "/data/pkgname.list")
if ctx.Bool("gopath") { if ctx.Bool("gopath") {

10
doc/conf.go

@ -35,6 +35,16 @@ var (
LocalNodes *goconfig.ConfigFile LocalNodes *goconfig.ConfigFile
) )
func init() {
hd, err := com.HomeDir()
if err != nil {
log.Error("", "Fail to get current user")
log.Fatal("", err.Error())
}
HomeDir = strings.Replace(RawHomeDir, "~", hd, -1)
}
func NewGopmfile(dirPath string) *goconfig.ConfigFile { func NewGopmfile(dirPath string) *goconfig.ConfigFile {
gf, err := goconfig.LoadConfigFile(dirPath + "/" + GopmFileName) gf, err := goconfig.LoadConfigFile(dirPath + "/" + GopmFileName)
if err != nil { if err != nil {

Loading…
Cancel
Save