From 1f100a2f6993b2cc41a9705a80db8b3ef8750a26 Mon Sep 17 00:00:00 2001 From: LXZ_svn_sync Date: Tue, 21 Nov 2017 18:06:39 +0800 Subject: [PATCH] svn_sync --- script/ide/FileSystemWatcher.lua | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/script/ide/FileSystemWatcher.lua b/script/ide/FileSystemWatcher.lua index 0f7d4e57..1cd6168a 100644 --- a/script/ide/FileSystemWatcher.lua +++ b/script/ide/FileSystemWatcher.lua @@ -94,8 +94,12 @@ end -- remove this file watcher. function FileSystemWatcher:Destroy() + self:RemoveAllDirectories(); unregisterCallback(self.name, self); - watcher_dirs[self.name] = nil; + + if( not call_backs[self.name]) then + watcher_dirs[self.name] = nil; + end end @@ -237,6 +241,18 @@ function FileSystemWatcher:RemoveDirectory(dir) end end +-- unwatch all directories +function FileSystemWatcher:RemoveAllDirectories() + while(true) do + local dir = next(self.dirs, nil); + if(dir) then + self:RemoveDirectory(dir); + else + break; + end + end +end + -- because it is so common to watch for asset file changes, we added the following function -- call this at any time to start watching for files function FileSystemWatcher.EnableAssetFileWatcher()