Ver código fonte

Fixed UpdateRebuildFileWatches removing watched directories

Brian Fiete 8 meses atrás
pai
commit
61b38b06c5
2 arquivos alterados com 17 adições e 1 exclusões
  1. 5 1
      IDE/src/Compiler/BfCompiler.bf
  2. 12 0
      IDE/src/FileWatcher.bf

+ 5 - 1
IDE/src/Compiler/BfCompiler.bf

@@ -987,7 +987,11 @@ namespace IDE.Compiler
 			{
 				if (!curWatches.Contains(kv.key))
 				{
-					gApp.mFileWatcher.RemoveWatch(kv.key, kv.value);
+					var watchFile = scope String(kv.key);
+					if ((watchFile.EndsWith(Path.DirectorySeparatorChar)) || (watchFile.EndsWith(Path.AltDirectorySeparatorChar)))
+						watchFile.Append("*");
+					gApp.mFileWatcher.RemoveWatch(watchFile, kv.value);
+					//Debug.Assert(!gApp.mFileWatcher.HasDependentObject(kv.value));
 					oldKeys.Add(kv.key);
 				}
 			}

+ 12 - 0
IDE/src/FileWatcher.bf

@@ -581,6 +581,18 @@ namespace IDE
 #endif
         }
 
+		public bool HasDependentObject(Object dependentObject)
+		{
+			for (var watchedFileKV in mWatchedFiles)
+			{
+				if (watchedFileKV.value.mDependentObjects.Contains(dependentObject))
+					return true;
+			}
+			if (mDependencyChangeSet.Contains(Internal.UnsafeCastToPtr(dependentObject)))
+				return true;
+			return false;
+		}
+
         public void Update(delegate void(String, String, WatcherChangeTypes) fileChangeHandler = null)
         {
 			while (true)