From c29c96b72c3ba2fcfa06da54c7fe3750bce4168b Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Thu, 25 Mar 2021 06:02:13 -0700 Subject: Minor CompareFiles optimization when source/target are same path --- src/WixToolset.Core.WindowsInstaller/Bind/FileSystemManager.cs | 6 ++++++ .../Bind/GetFileFacadesFromTransforms.cs | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/FileSystemManager.cs b/src/WixToolset.Core.WindowsInstaller/Bind/FileSystemManager.cs index 75477271..fe65ccef 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/FileSystemManager.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/FileSystemManager.cs @@ -2,6 +2,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind { + using System; using System.Collections.Generic; using System.IO; using WixToolset.Extensibility; @@ -31,6 +32,11 @@ namespace WixToolset.Core.WindowsInstaller.Bind private static bool BuiltinCompareFiles(string firstPath, string secondPath) { + if (String.Equals(firstPath, secondPath, StringComparison.OrdinalIgnoreCase)) + { + return true; + } + using (var firstStream = File.OpenRead(firstPath)) using (var secondStream = File.OpenRead(secondPath)) { diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/GetFileFacadesFromTransforms.cs b/src/WixToolset.Core.WindowsInstaller/Bind/GetFileFacadesFromTransforms.cs index ca074631..2ac563ac 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/GetFileFacadesFromTransforms.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/GetFileFacadesFromTransforms.cs @@ -91,7 +91,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind { // TODO: should this entire condition be placed in the binder file manager? if (/*(0 == (PatchAttributeType.Ignore & mainWixFileRow.PatchAttributes)) &&*/ - !this.FileSystemManager.CompareFiles(objectField.PreviousData.ToString(), objectField.Data.ToString())) + !this.FileSystemManager.CompareFiles(objectField.PreviousData, objectField.Data.ToString())) { // If the file is different, we need to mark the mainFileRow and pairedFileRow as modified. mainFileRow.Operation = RowOperation.Modify; -- cgit v1.2.3-55-g6feb