2019-11-06 00:00:00 +00:00
|
|
|
/*---------------------------------------------------------------------------------------------
|
|
|
|
|
* Copyright (c) Unity Technologies.
|
|
|
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
|
|
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
|
|
|
*--------------------------------------------------------------------------------------------*/
|
2023-06-27 00:00:00 +00:00
|
|
|
|
2019-11-06 00:00:00 +00:00
|
|
|
using System.Collections.Generic;
|
2023-06-27 00:00:00 +00:00
|
|
|
using System.IO;
|
2019-11-06 00:00:00 +00:00
|
|
|
|
|
|
|
|
namespace Microsoft.Unity.VisualStudio.Editor
|
|
|
|
|
{
|
|
|
|
|
internal static class Discovery
|
|
|
|
|
{
|
2020-10-30 00:00:00 +00:00
|
|
|
public static IEnumerable<IVisualStudioInstallation> GetVisualStudioInstallations()
|
2019-11-06 00:00:00 +00:00
|
|
|
{
|
2023-06-27 00:00:00 +00:00
|
|
|
foreach (var installation in VisualStudioCodeInstallation.GetVisualStudioInstallations())
|
|
|
|
|
yield return installation;
|
2019-11-06 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
|
2020-10-30 00:00:00 +00:00
|
|
|
public static bool TryDiscoverInstallation(string editorPath, out IVisualStudioInstallation installation)
|
2019-11-06 00:00:00 +00:00
|
|
|
{
|
2023-06-27 00:00:00 +00:00
|
|
|
try
|
2021-07-01 00:00:00 +00:00
|
|
|
{
|
2023-06-27 00:00:00 +00:00
|
|
|
if (VisualStudioCodeInstallation.TryDiscoverInstallation(editorPath, out installation))
|
|
|
|
|
return true;
|
2021-07-01 00:00:00 +00:00
|
|
|
}
|
2023-06-27 00:00:00 +00:00
|
|
|
catch (IOException)
|
2019-11-06 00:00:00 +00:00
|
|
|
{
|
2023-06-27 00:00:00 +00:00
|
|
|
installation = null;
|
2019-11-06 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
|
2023-06-27 00:00:00 +00:00
|
|
|
return false;
|
2019-11-06 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
|
2023-06-27 00:00:00 +00:00
|
|
|
public static void Initialize()
|
2019-11-06 00:00:00 +00:00
|
|
|
{
|
2023-06-27 00:00:00 +00:00
|
|
|
VisualStudioCodeInstallation.Initialize();
|
2019-11-06 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|