aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2021-03-25 06:02:13 -0700
committerRob Mensching <rob@firegiant.com>2021-03-25 10:04:58 -0700
commitc29c96b72c3ba2fcfa06da54c7fe3750bce4168b (patch)
tree0763b5062509f26c7b2f2d04f045a79391d70945 /src
parent42b570e34f9cfadbf6f6135cd6b55630c13538be (diff)
downloadwix-c29c96b72c3ba2fcfa06da54c7fe3750bce4168b.tar.gz
wix-c29c96b72c3ba2fcfa06da54c7fe3750bce4168b.tar.bz2
wix-c29c96b72c3ba2fcfa06da54c7fe3750bce4168b.zip
Minor CompareFiles optimization when source/target are same path
Diffstat (limited to 'src')
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Bind/FileSystemManager.cs6
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Bind/GetFileFacadesFromTransforms.cs2
2 files changed, 7 insertions, 1 deletions
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 @@
2 2
3namespace WixToolset.Core.WindowsInstaller.Bind 3namespace WixToolset.Core.WindowsInstaller.Bind
4{ 4{
5 using System;
5 using System.Collections.Generic; 6 using System.Collections.Generic;
6 using System.IO; 7 using System.IO;
7 using WixToolset.Extensibility; 8 using WixToolset.Extensibility;
@@ -31,6 +32,11 @@ namespace WixToolset.Core.WindowsInstaller.Bind
31 32
32 private static bool BuiltinCompareFiles(string firstPath, string secondPath) 33 private static bool BuiltinCompareFiles(string firstPath, string secondPath)
33 { 34 {
35 if (String.Equals(firstPath, secondPath, StringComparison.OrdinalIgnoreCase))
36 {
37 return true;
38 }
39
34 using (var firstStream = File.OpenRead(firstPath)) 40 using (var firstStream = File.OpenRead(firstPath))
35 using (var secondStream = File.OpenRead(secondPath)) 41 using (var secondStream = File.OpenRead(secondPath))
36 { 42 {
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
91 { 91 {
92 // TODO: should this entire condition be placed in the binder file manager? 92 // TODO: should this entire condition be placed in the binder file manager?
93 if (/*(0 == (PatchAttributeType.Ignore & mainWixFileRow.PatchAttributes)) &&*/ 93 if (/*(0 == (PatchAttributeType.Ignore & mainWixFileRow.PatchAttributes)) &&*/
94 !this.FileSystemManager.CompareFiles(objectField.PreviousData.ToString(), objectField.Data.ToString())) 94 !this.FileSystemManager.CompareFiles(objectField.PreviousData, objectField.Data.ToString()))
95 { 95 {
96 // If the file is different, we need to mark the mainFileRow and pairedFileRow as modified. 96 // If the file is different, we need to mark the mainFileRow and pairedFileRow as modified.
97 mainFileRow.Operation = RowOperation.Modify; 97 mainFileRow.Operation = RowOperation.Modify;