Explorar o código

Reapply zombie editor fix

Josh Engebretson %!s(int64=9) %!d(string=hai) anos
pai
achega
619b98c743
Modificáronse 1 ficheiros con 20 adicións e 0 borrados
  1. 20 0
      Source/Atomic/IO/FileWatcher.cpp

+ 20 - 0
Source/Atomic/IO/FileWatcher.cpp

@@ -89,6 +89,26 @@ bool FileWatcher::StartWatching(const String& pathName, bool watchSubDirs)
 #ifdef _WIN32
     String nativePath = GetNativePath(RemoveTrailingSlash(pathName));
 
+    // ATOMIC BEGIN
+
+    // Create a dummy file to make sure the path is writeable, otherwise we would hang at exit
+    // This isn't terribly elegant, though avoids a cluser of Windows security API
+    String dummyFileName = nativePath + "/" + "dummy.tmp";
+    File file(context_, dummyFileName, FILE_WRITE);
+    if (file.IsOpen())
+    {
+        file.Close();
+        if (fileSystem_)
+            fileSystem_->Delete(dummyFileName);
+    }
+    else
+    {
+        LOGDEBUGF("FileWatcher::StartWatching - Ignoring non-writable path %s", nativePath.CString());
+        return false;
+    }
+
+    // ATOMIC END
+
     dirHandle_ = (void*)CreateFileW(
         WString(nativePath).CString(),
         FILE_LIST_DIRECTORY,