36 lines
1007 B
Go
36 lines
1007 B
Go
package main
|
|
|
|
/*
|
|
func (s *Moonshark) setupWatchers() {
|
|
manager := watchers.GetWatcherManager()
|
|
|
|
// Watch routes
|
|
if routeWatcher, err := watchers.WatchLuaRouter(s.LuaRouter, s.LuaRunner, s.Config.Dirs.Routes); err != nil {
|
|
logger.Warnf("Routes directory watch failed: %v", err)
|
|
} else {
|
|
routesDir := routeWatcher.GetDir()
|
|
s.cleanupFuncs = append(s.cleanupFuncs, func() error {
|
|
return manager.UnwatchDirectory(routesDir)
|
|
})
|
|
}
|
|
|
|
// Watch modules
|
|
if moduleWatchers, err := watchers.WatchLuaModules(s.LuaRunner, s.Config.Dirs.Libs); err != nil {
|
|
logger.Warnf("Module directories watch failed: %v", err)
|
|
} else {
|
|
for _, watcher := range moduleWatchers {
|
|
dirPath := watcher.GetDir()
|
|
s.cleanupFuncs = append(s.cleanupFuncs, func() error {
|
|
return manager.UnwatchDirectory(dirPath)
|
|
})
|
|
}
|
|
|
|
plural := "directory"
|
|
if len(moduleWatchers) != 1 {
|
|
plural = "directories"
|
|
}
|
|
logger.Infof("Watching %s module %s.", color.Yellow(strconv.Itoa(len(moduleWatchers))), plural)
|
|
}
|
|
}
|
|
*/
|