prints the file extension

This commit is contained in:
alessio 2016-08-23 14:07:01 +02:00
parent 91f34866e0
commit dcad2e23b0
1 changed files with 9 additions and 1 deletions

View File

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