diff options
| author | Rob Mensching <rob@firegiant.com> | 2022-11-08 14:58:05 -0800 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2022-11-08 16:20:25 -0800 |
| commit | c843b47d6233153fa961c6d0e61edf7cedf255bb (patch) | |
| tree | 9eae6badd42d3badb8665b7414b4d44ca48d6ae1 /src/internal/WixBuildTools.TestSupport/VswhereRunner.cs | |
| parent | 7e498d6348c26583972ea1cdf7d51dadc8f5b792 (diff) | |
| download | wix-c843b47d6233153fa961c6d0e61edf7cedf255bb.tar.gz wix-c843b47d6233153fa961c6d0e61edf7cedf255bb.tar.bz2 wix-c843b47d6233153fa961c6d0e61edf7cedf255bb.zip | |
Separate WixInternal content from official WixToolset namespace
Diffstat (limited to 'src/internal/WixBuildTools.TestSupport/VswhereRunner.cs')
| -rw-r--r-- | src/internal/WixBuildTools.TestSupport/VswhereRunner.cs | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/src/internal/WixBuildTools.TestSupport/VswhereRunner.cs b/src/internal/WixBuildTools.TestSupport/VswhereRunner.cs deleted file mode 100644 index 0197e125..00000000 --- a/src/internal/WixBuildTools.TestSupport/VswhereRunner.cs +++ /dev/null | |||
| @@ -1,41 +0,0 @@ | |||
| 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
| 2 | |||
| 3 | namespace WixBuildTools.TestSupport | ||
| 4 | { | ||
| 5 | using System; | ||
| 6 | using System.IO; | ||
| 7 | |||
| 8 | public class VswhereRunner : ExternalExecutable | ||
| 9 | { | ||
| 10 | private static readonly string VswhereRelativePath = @"Microsoft Visual Studio\Installer\vswhere.exe"; | ||
| 11 | |||
| 12 | private static readonly object InitLock = new object(); | ||
| 13 | private static bool Initialized; | ||
| 14 | private static VswhereRunner Instance; | ||
| 15 | |||
| 16 | public static ExternalExecutableResult Execute(string args, bool mergeErrorIntoOutput = false) => | ||
| 17 | InitAndExecute(args, mergeErrorIntoOutput); | ||
| 18 | |||
| 19 | private static ExternalExecutableResult InitAndExecute(string args, bool mergeErrorIntoOutput) | ||
| 20 | { | ||
| 21 | lock (InitLock) | ||
| 22 | { | ||
| 23 | if (!Initialized) | ||
| 24 | { | ||
| 25 | Initialized = true; | ||
| 26 | var vswherePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), VswhereRelativePath); | ||
| 27 | if (!File.Exists(vswherePath)) | ||
| 28 | { | ||
| 29 | throw new InvalidOperationException($"Failed to find vswhere at: {vswherePath}"); | ||
| 30 | } | ||
| 31 | |||
| 32 | Instance = new VswhereRunner(vswherePath); | ||
| 33 | } | ||
| 34 | } | ||
| 35 | |||
| 36 | return Instance.Run(args, mergeErrorIntoOutput); | ||
| 37 | } | ||
| 38 | |||
| 39 | private VswhereRunner(string exePath) : base(exePath) { } | ||
| 40 | } | ||
| 41 | } | ||
