aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2020-05-10 12:51:16 +1000
committerSean Hall <r.sean.hall@gmail.com>2020-05-10 13:56:20 +1000
commitc7a1b6b6ea12b3f231d3d8f83590bda74b9284e5 (patch)
tree72fb6469b8538d3d8537c6e011624c80222a9962 /src
parent670075995cf1b78d0a66e1a7678fd2facc8958ff (diff)
downloadwix-c7a1b6b6ea12b3f231d3d8f83590bda74b9284e5.tar.gz
wix-c7a1b6b6ea12b3f231d3d8f83590bda74b9284e5.tar.bz2
wix-c7a1b6b6ea12b3f231d3d8f83590bda74b9284e5.zip
The directory separator on non-Windows platforms is ':'
Diffstat (limited to 'src')
-rw-r--r--src/WixToolset.Core.Native/WixNativeExe.cs28
1 files changed, 15 insertions, 13 deletions
diff --git a/src/WixToolset.Core.Native/WixNativeExe.cs b/src/WixToolset.Core.Native/WixNativeExe.cs
index 063485d3..2ea5146e 100644
--- a/src/WixToolset.Core.Native/WixNativeExe.cs
+++ b/src/WixToolset.Core.Native/WixNativeExe.cs
@@ -8,6 +8,7 @@ namespace WixToolset.Core.Native
8 using System.Diagnostics; 8 using System.Diagnostics;
9 using System.IO; 9 using System.IO;
10 using System.Reflection; 10 using System.Reflection;
11 using System.Runtime.InteropServices;
11 12
12 internal class WixNativeExe 13 internal class WixNativeExe
13 { 14 {
@@ -82,28 +83,29 @@ namespace WixToolset.Core.Native
82 if (String.IsNullOrEmpty(PathToWixNativeExe)) 83 if (String.IsNullOrEmpty(PathToWixNativeExe))
83 { 84 {
84 var path = Path.Combine(Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath), WixNativeExeFileName); 85 var path = Path.Combine(Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath), WixNativeExeFileName);
86 var possiblePaths = path;
85 87
86 if (!File.Exists(path)) 88 var found = File.Exists(path);
89 if (!found && AppContext.GetData("NATIVE_DLL_SEARCH_DIRECTORIES") is string searchDirectoriesString)
87 { 90 {
88 var searchDirectoriesString = AppContext.GetData("NATIVE_DLL_SEARCH_DIRECTORIES") as string; 91 possiblePaths = searchDirectoriesString;
89 var searchDirectories = searchDirectoriesString?.Split(';'); 92 var separatorChar = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ';' : ':';
90 if (searchDirectories != null) 93 var searchDirectories = searchDirectoriesString?.Split(separatorChar);
94 foreach (var directoryPath in searchDirectories)
91 { 95 {
92 foreach (string directoryPath in searchDirectories) 96 var possiblePath = Path.Combine(directoryPath, WixNativeExeFileName);
97 if (File.Exists(possiblePath))
93 { 98 {
94 var possiblePath = Path.Combine(directoryPath, WixNativeExeFileName); 99 path = possiblePath;
95 if (File.Exists(possiblePath)) 100 found = true;
96 { 101 break;
97 path = possiblePath;
98 break;
99 }
100 } 102 }
101 } 103 }
102 } 104 }
103 105
104 if (!File.Exists(path)) 106 if (!found)
105 { 107 {
106 throw new FileNotFoundException($"Could not find internal piece of WiX Toolset at: {path}", path); 108 throw new FileNotFoundException($"Could not find internal piece of WiX Toolset at: {possiblePaths}", WixNativeExeFileName);
107 } 109 }
108 110
109 PathToWixNativeExe = path; 111 PathToWixNativeExe = path;