From dcad2e23b0e4a048f06293701e3eb0d1cd8ce7bd Mon Sep 17 00:00:00 2001 From: alessio Date: Tue, 23 Aug 2016 14:07:01 +0200 Subject: [PATCH] prints the file extension --- realize/watcher.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/realize/watcher.go b/realize/watcher.go index f78dd31..ce53228 100644 --- a/realize/watcher.go +++ b/realize/watcher.go @@ -128,9 +128,17 @@ func (p *Project) watching() { continue } if _, err := os.Stat(event.Name); err == nil { + var ext string + if index := strings.Index(filepath.Ext(event.Name), "_"); index == -1 { + ext = filepath.Ext(event.Name) + } else { + ext = filepath.Ext(event.Name) + ext = ext[0:index] + } + i := strings.Index(event.Name, filepath.Ext(event.Name)) if event.Name[:i] != "" { - log.Println(pname(p.Name, 4), ":", Magenta(event.Name[:i])) + log.Println(pname(p.Name, 4), ":", Magenta(event.Name[:i]+ext)) // stop and run again if p.Run {