Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono-addins.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Ward <matt.ward@microsoft.com>2021-02-19 17:09:21 +0300
committerMatt Ward <matt.ward@microsoft.com>2021-02-19 17:09:21 +0300
commitf8ce8e8a321d00904fd46f6dbbf3cd0796620d00 (patch)
tree57fbf7ea56b3a56cb7d56dcdb78c4958c16627a8
parentae7377ed39bb739c5343c7703604ea97c70464f6 (diff)
Support launch external setup process with dotnet
The original logic tried to run the dll directly which did not work. Now a check is made to see if the .exe is available and that is run if it is available. Then a check is made to see if there is a native build of the exe available. Finally the code falls back to running the dll with dotnet.
-rw-r--r--Mono.Addins/Mono.Addins.Database/SetupProcess.cs40
1 files changed, 27 insertions, 13 deletions
diff --git a/Mono.Addins/Mono.Addins.Database/SetupProcess.cs b/Mono.Addins/Mono.Addins.Database/SetupProcess.cs
index e3da326..6b0255f 100644
--- a/Mono.Addins/Mono.Addins.Database/SetupProcess.cs
+++ b/Mono.Addins/Mono.Addins.Database/SetupProcess.cs
@@ -69,20 +69,8 @@ namespace Mono.Addins.Database
Process process = new Process ();
- string thisAsmDir = Path.GetDirectoryName (typeof (SetupProcess).Assembly.Location);
- string asm;
- if (Util.IsMono)
- asm = Path.Combine (thisAsmDir, "Mono.Addins.SetupProcess.exe");
- else
- asm = Path.Combine (thisAsmDir, "Mono.Addins.SetupProcess.dll");
-
try {
- if (!Util.IsMono)
- process.StartInfo = new ProcessStartInfo (asm, sb.ToString ());
- else {
- asm = asm.Replace(" ", @"\ ");
- process.StartInfo = new ProcessStartInfo ("mono", "--debug " + asm + " " + sb.ToString ());
- }
+ process.StartInfo = CreateProcessStartInfo (sb.ToString ());
process.StartInfo.WorkingDirectory = AppDomain.CurrentDomain.BaseDirectory;
process.StartInfo.UseShellExecute = false;
process.StartInfo.CreateNoWindow = true;
@@ -114,6 +102,32 @@ namespace Mono.Addins.Database
throw;
}
}
+
+ static ProcessStartInfo CreateProcessStartInfo (string arguments)
+ {
+ string thisAsmDir = Path.GetDirectoryName (typeof (SetupProcess).Assembly.Location);
+ string asm = Path.Combine (thisAsmDir, "Mono.Addins.SetupProcess.exe");
+
+ if (File.Exists (asm)) {
+ if (Util.IsMono) {
+ asm = asm.Replace (" ", @"\ ");
+ return new ProcessStartInfo ("mono", "--debug " + asm + " " + arguments);
+ }
+ return new ProcessStartInfo (asm, arguments);
+ }
+
+ asm = Path.Combine(thisAsmDir, "Mono.Addins.SetupProcess");
+ if (File.Exists (asm))
+ return new ProcessStartInfo (asm, arguments);
+
+ asm = Path.Combine (thisAsmDir, "Mono.Addins.SetupProcess.dll");
+ if (File.Exists (asm)) {
+ asm = asm.Replace (" ", @"\ ");
+ return new ProcessStartInfo ("dotnet", asm + " " + arguments);
+ }
+
+ throw new InvalidOperationException ("Mono.Addins.SetupProcess not found");
+ }
}
class ProcessFailedException: Exception