File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change 94
94
95
95
-- remove this file watcher.
96
96
function FileSystemWatcher :Destroy ()
97
+ self :RemoveAllDirectories ();
97
98
unregisterCallback (self .name , self );
98
- watcher_dirs [self .name ] = nil ;
99
+
100
+ if ( not call_backs [self .name ]) then
101
+ watcher_dirs [self .name ] = nil ;
102
+ end
99
103
end
100
104
101
105
@@ -237,6 +241,18 @@ function FileSystemWatcher:RemoveDirectory(dir)
237
241
end
238
242
end
239
243
244
+ -- unwatch all directories
245
+ function FileSystemWatcher :RemoveAllDirectories ()
246
+ while (true ) do
247
+ local dir = next (self .dirs , nil );
248
+ if (dir ) then
249
+ self :RemoveDirectory (dir );
250
+ else
251
+ break ;
252
+ end
253
+ end
254
+ end
255
+
240
256
-- because it is so common to watch for asset file changes, we added the following function
241
257
-- call this at any time to start watching for files
242
258
function FileSystemWatcher .EnableAssetFileWatcher ()
You can’t perform that action at this time.
0 commit comments