From 9c558af6f1757d1686d0d497e397deeb3a15bfd3 Mon Sep 17 00:00:00 2001 From: liudng Date: Wed, 8 Jul 2015 17:21:32 +0800 Subject: [PATCH] Update depends. --- dogo.go | 8 ++++---- dogo.json | 2 +- dogo_windows.go | 2 +- main.go | 21 +++++---------------- 4 files changed, 11 insertions(+), 22 deletions(-) diff --git a/dogo.go b/dogo.go index 5c6727a..ce86d63 100644 --- a/dogo.go +++ b/dogo.go @@ -85,8 +85,10 @@ func (d *Dogo) NewMonitor() { } } - console.Chdir(d.WorkingDir) + // Append the current directory to the PATH for compatible linux. + console.Setenv("PATH", console.Getenv("PATH")+string(os.PathListSeparator)+d.WorkingDir) + console.Chdir(d.WorkingDir) fmt.Printf("[dogo] Working Directory:\n") fmt.Printf(" %s\n", d.WorkingDir) @@ -194,12 +196,10 @@ func (d *Dogo) Run() { d.cmd.Stderr = os.Stderr err := d.cmd.Run() if err != nil { - //fmt.Printf("%s\n", err) + fmt.Printf("%s\n", err) } else { d.cmd = nil - //fmt.Printf("exit status 0.\n") } - //d.isRunning = false } func (d *Dogo) LogPrintf(format string, v ...interface{}) { diff --git a/dogo.json b/dogo.json index 9fad20a..8b3209c 100644 --- a/dogo.json +++ b/dogo.json @@ -5,6 +5,6 @@ ], "SourceExt": ".go|.c|.cpp|.h", "BuildCmd": "go build github.com/liudng/dogo/example", - "RunCmd": "example.exe", + "RunCmd": "example", "Decreasing": 1 } diff --git a/dogo_windows.go b/dogo_windows.go index 3c9d7bc..0c19116 100644 --- a/dogo_windows.go +++ b/dogo_windows.go @@ -41,7 +41,7 @@ func (d *Dogo) Monitor() { if dwWaitStatus >= 0 && dwWaitStatus < handlesCount { if d.decreasing > 0 { d.decreasing-- - //d.FmtPrintf("[dogo] Decreasing: %v\n", d.SourceDir[dwWaitStatus]) + d.FmtPrintf("[dogo] Decreasing %d: %v\n", d.decreasing, d.SourceDir[dwWaitStatus]) } else { d.isModified = true d.FmtPrintf("[dogo] Changed files: %v\n", d.SourceDir[dwWaitStatus]) diff --git a/main.go b/main.go index d59ef8e..29e21c7 100644 --- a/main.go +++ b/main.go @@ -16,35 +16,24 @@ func main() { flag.StringVar(&c, "c", console.WorkingDir+"/dogo.json", "Usage: dogo -c=/path/to/dogo.json") flag.Parse() - New(c) -} - -func New(c string) { var dogo Dogo gopath := console.Getenv("GOPATH") - - r := make(map[string]string) - r["{GOPATH}"] = gopath - c = strings.Replace(c, "{GOPATH}", gopath, -1) - - cfg := console.NewConfig(console.ConfigFile, c, r) - err := cfg.Parse(&dogo) + r := map[string]string{"{GOPATH}": gopath} + err := console.NewConfig(c).Replace(r).Parse(&dogo) if err != nil { - fmt.Println("[dogo] Warning: no configuration file loaded.") + fmt.Printf("[dogo] Warning: no configuration file loaded.\n") } else { - fmt.Println("[dogo] Loaded configuration file: ", c) + fmt.Printf("[dogo] Loaded configuration file:\n") + fmt.Printf(" %s\n", c) } dogo.NewMonitor() - l := len(dogo.Files) if l > 0 { fmt.Printf("[dogo] Ready. %d files to be monitored.\n\n", l) - dogo.BuildAndRun() - dogo.Monitor() } else { fmt.Printf("[dogo] Error: Did not find any files. Press any key to exit.\n\n")