run/fast slash fixed

This commit is contained in:
alessio 2016-08-22 13:29:21 +02:00
parent 2c40a0ebf7
commit a0aace6733
2 changed files with 5 additions and 6 deletions

View File

@ -31,12 +31,13 @@ func (p *Project) GoRun(channel chan bool, runner chan bool, wr *sync.WaitGroup)
stop := make(chan bool, 1) stop := make(chan bool, 1)
var run string var run string
if len(name) == 1 { if name[len(name)-1] == "" {
name := strings.Split(p.base, "/") name := strings.Split(slash(p.base), "/")
run = name[len(name)-1] run = name[len(name)-1]
} else { } else {
run = name[len(name)-1] run = name[len(name)-1]
} }
build := exec.Command(slash(os.Getenv("GOBIN")) + slash(run)) build := exec.Command(slash(os.Getenv("GOBIN")) + slash(run))
build.Dir = p.base build.Dir = p.base
defer func() { defer func() {

View File

@ -45,6 +45,7 @@ func (h *Config) Fast(params *cli.Context) error {
fast := h.Projects[0] fast := h.Projects[0]
// Takes the values from config if wd path match someone else // Takes the values from config if wd path match someone else
if params.Bool("config") { if params.Bool("config") {
fmt.Println(params.Bool("config"))
if err := h.Read(); err == nil { if err := h.Read(); err == nil {
for _, val := range h.Projects { for _, val := range h.Projects {
if fast.Path == val.Path { if fast.Path == val.Path {
@ -104,7 +105,6 @@ func (p *Project) Watching() {
defer end() defer end()
p.base = base + p.Path p.base = base + p.Path
for _, dir := range p.Watcher.Paths { for _, dir := range p.Watcher.Paths {
// check main existence // check main existence
dir = slash(dir) dir = slash(dir)
@ -230,10 +230,8 @@ func slash(str string) string {
str = "/" + str str = "/" + str
} }
if string(str[len(str)-1]) == "/" { if string(str[len(str)-1]) == "/" {
if len(str) == 0 { if string(str) == "/" {
return str return str
} else if string(str) == "/" {
str = ""
} else { } else {
str = str[0 : len(str)-1] str = str[0 : len(str)-1]
} }