aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Core.Native/WixNativeExe.cs
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2020-05-09 21:08:49 +1000
committerSean Hall <r.sean.hall@gmail.com>2020-05-09 21:11:56 +1000
commit670075995cf1b78d0a66e1a7678fd2facc8958ff (patch)
treedf7f699b85e34bb8f487fdad64aaaa9cb8dbfe9f /src/WixToolset.Core.Native/WixNativeExe.cs
parentdf6e15e2b026f8a419fb275c0b50c9d3b3298859 (diff)
downloadwix-670075995cf1b78d0a66e1a7678fd2facc8958ff.tar.gz
wix-670075995cf1b78d0a66e1a7678fd2facc8958ff.tar.bz2
wix-670075995cf1b78d0a66e1a7678fd2facc8958ff.zip
Use NATIVE_DLL_SEARCH_DIRECTORIES to support cross-platform wixnative.exe
Diffstat (limited to 'src/WixToolset.Core.Native/WixNativeExe.cs')
-rw-r--r--src/WixToolset.Core.Native/WixNativeExe.cs21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/WixToolset.Core.Native/WixNativeExe.cs b/src/WixToolset.Core.Native/WixNativeExe.cs
index 935c2a89..063485d3 100644
--- a/src/WixToolset.Core.Native/WixNativeExe.cs
+++ b/src/WixToolset.Core.Native/WixNativeExe.cs
@@ -11,6 +11,7 @@ namespace WixToolset.Core.Native
11 11
12 internal class WixNativeExe 12 internal class WixNativeExe
13 { 13 {
14 private const string WixNativeExeFileName = "wixnative.exe";
14 private static string PathToWixNativeExe; 15 private static string PathToWixNativeExe;
15 16
16 private readonly string commandLine; 17 private readonly string commandLine;
@@ -80,7 +81,25 @@ namespace WixToolset.Core.Native
80 { 81 {
81 if (String.IsNullOrEmpty(PathToWixNativeExe)) 82 if (String.IsNullOrEmpty(PathToWixNativeExe))
82 { 83 {
83 var path = Path.Combine(Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath), "wixnative.x86.exe"); 84 var path = Path.Combine(Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath), WixNativeExeFileName);
85
86 if (!File.Exists(path))
87 {
88 var searchDirectoriesString = AppContext.GetData("NATIVE_DLL_SEARCH_DIRECTORIES") as string;
89 var searchDirectories = searchDirectoriesString?.Split(';');
90 if (searchDirectories != null)
91 {
92 foreach (string directoryPath in searchDirectories)
93 {
94 var possiblePath = Path.Combine(directoryPath, WixNativeExeFileName);
95 if (File.Exists(possiblePath))
96 {
97 path = possiblePath;
98 break;
99 }
100 }
101 }
102 }
84 103
85 if (!File.Exists(path)) 104 if (!File.Exists(path))
86 { 105 {