base path moved to run method

This commit is contained in:
alessio 2017-08-31 09:47:55 +02:00
parent 98b9680984
commit a68962368d
1 changed files with 16 additions and 4 deletions

View File

@ -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
}