From: jaehoon.hyun Date: Tue, 2 Apr 2019 06:25:44 +0000 (+0900) Subject: watcher do not watch CHMOD X-Git-Tag: submit/tizen/20190409.085658~6^2~15 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bd000d1b70630191ce3da1e6d226defc12b576b7;p=platform%2Fcore%2Fsystem%2Fedge-orchestration.git watcher do not watch CHMOD --- diff --git a/src/configuremgr/watchConfPath.go b/src/configuremgr/watchConfPath.go index 9828707..fcf5703 100644 --- a/src/configuremgr/watchConfPath.go +++ b/src/configuremgr/watchConfPath.go @@ -3,6 +3,7 @@ package configuremgr import ( "strings" + "os" confdescription "configuremgr/description" @@ -47,11 +48,19 @@ func (cfgMgr *ConfigureMgr) installConfigure(path string) { cfg := new(confdescription.Doc) libPath, confPath := cfgMgr.getdirname(path) + + //NOTE : copy but really copy, it can be not existed. + for { + if _, err := os.Stat(confPath); os.IsNotExist(err) { + + }else{ + break + } + } sconf.Must(cfg).Read(ini.File(confPath)) cfgMgr.IScoringMgr.PushLibPath(libPath, cfg, cfgMgr.IScoringMgr.Ch) cfgMgr.IDiscoveryMgr.PushConfPath(cfg) // cfgMgr.IAppExecuteMgr.PushConfPath(cfg) - } func (cfgMgr *ConfigureMgr) getdirname(path string) (libPath, confPath string) { @@ -91,25 +100,29 @@ func (cfgMgr *ConfigureMgr) Watch(path string) { } ILog.Println("log event:", event) - if event.Op & fsnotify.Create == fsnotify.Create { - cfgMgr.installConfigure(event.Name) + switch(event.Op){ + case fsnotify.Create: + // case fsnotify.Chmod: + cfgMgr.installConfigure(event.Name) + } + case err, ok := <-watcher.Errors: if !ok { return } ELog.Println("error:", err) - } - } + + } //selecte end + } //for end }() err = watcher.Add(path) if err != nil { ELog.Fatal(err) } - - <- cfgMgr.Done + <- cfgMgr.Done ILog.Println("configuremgr watch end") } \ No newline at end of file