Przeglądaj źródła

Fix where querying directory children wasn't releasing file handle properly

Marko Pintera 11 lat temu
rodzic
commit
929f93af56
1 zmienionych plików z 6 dodań i 1 usunięć
  1. 6 1
      BansheeUtility/Source/Win32/BsFileSystem.cpp

+ 6 - 1
BansheeUtility/Source/Win32/BsFileSystem.cpp

@@ -292,6 +292,9 @@ namespace BansheeEngine
 	{
 	{
 		WString fullPathStr = fullPath.toWString();
 		WString fullPathStr = fullPath.toWString();
 
 
+		if (!FileSystem::exists(fullPath))
+			return;
+
 		if (recursively)
 		if (recursively)
 		{
 		{
 			Vector<Path> files;
 			Vector<Path> files;
@@ -356,8 +359,8 @@ namespace BansheeEngine
 
 
 		for (UINT32 i = parentPath.getNumDirectories(); i < fullPath.getNumDirectories(); i++)
 		for (UINT32 i = parentPath.getNumDirectories(); i < fullPath.getNumDirectories(); i++)
 		{
 		{
-			win32_createDirectory(parentPath.toWString());
 			parentPath.append(fullPath[i]);
 			parentPath.append(fullPath[i]);
+			win32_createDirectory(parentPath.toWString());
 		}
 		}
 	}
 	}
 
 
@@ -399,6 +402,8 @@ namespace BansheeEngine
 
 
 			lastFailed = FindNextFileW(fileHandle, &findData) == FALSE;
 			lastFailed = FindNextFileW(fileHandle, &findData) == FALSE;
 		} while (true);
 		} while (true);
+
+		FindClose(fileHandle);
 	}
 	}
 
 
 	std::time_t FileSystem::getLastModifiedTime(const Path& fullPath)
 	std::time_t FileSystem::getLastModifiedTime(const Path& fullPath)