build exec fixed

This commit is contained in:
asoseil 2017-10-16 13:58:13 +02:00
parent 0a4b5eb1be
commit 9e3408bcf5
1 changed files with 9 additions and 9 deletions

18
exec.go
View File

@ -75,20 +75,20 @@ func (p *Project) goRun(stop <-chan bool, runner chan bool) {
}
if _, err := os.Stat(filepath.Join(p.base, p.path)); err == nil {
p.path = filepath.Join(p.base, p.path)
}
if _, err := os.Stat(filepath.Join(p.base, p.path+".exe")); err == nil {
p.path = filepath.Join(p.base, p.path+".exe")
}
if _, err := os.Stat(filepath.Join(getEnvPath("GOBIN"), filepath.Base(p.path))); err == nil {
build = exec.Command(filepath.Join(getEnvPath("GOBIN"), filepath.Base(p.path)), args...)
} else if _, err := os.Stat(filepath.Join(getEnvPath("GOBIN"), filepath.Base(p.path)) + ".exe"); err == nil {
build = exec.Command(filepath.Join(getEnvPath("GOBIN"), filepath.Base(p.path))+".exe", args...)
} else {
p.Buffer.StdLog = append(p.Buffer.StdLog, BufferOut{Time: time.Now(), Text: "Can't run a not compiled project"})
p.fatal(err, "Can't run a not compiled project", ":")
path := filepath.Join(p.base, filepath.Base(p.path))
if _, err = os.Stat(path); err == nil {
build = exec.Command(path, args...)
} else if _, err = os.Stat(path + ".exe"); err == nil {
build = exec.Command(path+".exe", args...)
} else {
p.Buffer.StdLog = append(p.Buffer.StdLog, BufferOut{Time: time.Now(), Text: "Can't run a not compiled project"})
p.fatal(nil, "Can't run a not compiled project", ":")
}
}
defer func() {