From 9e3408bcf54a00d38f9f1327ba003d548c4ae642 Mon Sep 17 00:00:00 2001 From: asoseil Date: Mon, 16 Oct 2017 13:58:13 +0200 Subject: [PATCH] build exec fixed --- exec.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/exec.go b/exec.go index c359288..b98239b 100644 --- a/exec.go +++ b/exec.go @@ -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() {