Skip to content

Commit

Permalink
Update depends.
Browse files Browse the repository at this point in the history
  • Loading branch information
liudng committed Jul 8, 2015
1 parent fce3b80 commit 9c558af
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 22 deletions.
8 changes: 4 additions & 4 deletions dogo.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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{}) {
Expand Down
2 changes: 1 addition & 1 deletion dogo.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
],
"SourceExt": ".go|.c|.cpp|.h",
"BuildCmd": "go build github.com/liudng/dogo/example",
"RunCmd": "example.exe",
"RunCmd": "example",
"Decreasing": 1
}
2 changes: 1 addition & 1 deletion dogo_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down
21 changes: 5 additions & 16 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 9c558af

Please sign in to comment.