From 7065821e431ece0fb646e03bcffaa17b05268569 Mon Sep 17 00:00:00 2001
From: Rye Mutt <rye@alchemyviewer.org>
Date: Mon, 20 Jul 2020 17:30:02 -0400
Subject: [PATCH] Mildy faster gDirUtilp fileExists on win platform

---
 indra/llvfs/CMakeLists.txt  |  4 ++++
 indra/llvfs/lldir_win32.cpp | 16 +++-------------
 2 files changed, 7 insertions(+), 13 deletions(-)

diff --git a/indra/llvfs/CMakeLists.txt b/indra/llvfs/CMakeLists.txt
index 67dce8c0737..ea0d7e498ea 100644
--- a/indra/llvfs/CMakeLists.txt
+++ b/indra/llvfs/CMakeLists.txt
@@ -75,6 +75,10 @@ target_link_libraries(llvfs
     ${vfs_BOOST_LIBRARIES}
     )
 
+if (WINDOWS)
+  target_link_libraries(llvfs Shlwapi)
+endif (WINDOWS)
+
 if (DARWIN)
   include(CMakeFindFrameworks)
   find_library(COCOA_LIBRARY Cocoa)
diff --git a/indra/llvfs/lldir_win32.cpp b/indra/llvfs/lldir_win32.cpp
index aa9aa33af98..73cbf77b17b 100644
--- a/indra/llvfs/lldir_win32.cpp
+++ b/indra/llvfs/lldir_win32.cpp
@@ -40,6 +40,7 @@
 #include <errno.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <shlwapi.h>
 
 // Utility stuff to get versions of the sh
 #define PACKVERSION(major,minor) MAKELONG(minor,major)
@@ -371,20 +372,9 @@ std::string LLDir_Win32::getCurPath()
 }
 
 
-bool LLDir_Win32::fileExists(const std::string &filename) const
+bool LLDir_Win32::fileExists(const std::string& filename) const
 {
-	llstat stat_data;
-	// Check the age of the file
-	// Now, we see if the files we've gathered are recent...
-	int res = LLFile::stat(filename, &stat_data);
-	if (!res)
-	{
-		return TRUE;
-	}
-	else
-	{
-		return FALSE;
-	}
+	return PathFileExists(ll_convert_string_to_wide(filename).c_str());
 }
 
 
-- 
GitLab