From a68962368d9915cc0571e51dfb2283598456467a Mon Sep 17 00:00:00 2001 From: alessio Date: Thu, 31 Aug 2017 09:47:55 +0200 Subject: [PATCH] base path moved to run method --- watcher/cmd.go | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/watcher/cmd.go b/watcher/cmd.go index d2c078b..b3bdd26 100644 --- a/watcher/cmd.go +++ b/watcher/cmd.go @@ -8,6 +8,7 @@ import ( "os" "strings" "time" + "path/filepath" ) // Run launches the toolchain for each project @@ -65,6 +66,21 @@ func (h *Blueprint) Run(p *cli.Context) error { h.Projects[k].Buffer.StdErr = append(h.Projects[k].Buffer.StdErr, BufferOut{Time: time.Now(), Text: err.Error(), Type: "Env error", Stream: ""}) } } + + // base path of the project + wd, err := os.Getwd() + if err != nil{ + return err + } + if element.path == "." || element.path == "/" { + h.Projects[k].base = wd + h.Projects[k].path = element.Wdir() + } else if filepath.IsAbs(element.path) { + h.Projects[k].base = element.path + } else { + h.Projects[k].base = filepath.Join(wd, element.path) + } + if h.Legacy.Status { go h.Projects[k].watchByPolling() } else { @@ -175,10 +191,6 @@ func (h *Blueprint) List() error { } } } - fmt.Fprintln(style.Output, name, style.Yellow.Regular("Streams"), ":") - fmt.Fprintln(style.Output, name, "\t", style.Yellow.Regular("File Out"), ":", style.Magenta.Regular(val.Streams.FileOut)) - fmt.Fprintln(style.Output, name, "\t", style.Yellow.Regular("File Log"), ":", style.Magenta.Regular(val.Streams.FileLog)) - fmt.Fprintln(style.Output, name, "\t", style.Yellow.Regular("File Err"), ":", style.Magenta.Regular(val.Streams.FileErr)) } return nil }