You've already forked com.unity.ide.cursor
mirror of
https://github.com/boxqkrtm/com.unity.ide.cursor.git
synced 2026-05-15 23:10:06 +00:00
## [2.0.22] - 2023-10-03 Integration: - Add support for `XDG_DATA_DIRS` and `.desktop` files on Linux for `VS Code` discovery. - Use compile-time platform-specifics instead of using runtime conditions. Project generation: - Suppress `USG0001` warnings. - Mark referenced assemblies as private (to not copy extra files to output directory when building). - Add Unity capability to SDK-Style projects. - Prevent circular dependency errors with SDK-Style projects.
61 lines
1.9 KiB
C#
61 lines
1.9 KiB
C#
/*---------------------------------------------------------------------------------------------
|
|
* 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.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
|
|
namespace Microsoft.Unity.VisualStudio.Editor
|
|
{
|
|
internal static class Discovery
|
|
{
|
|
public static IEnumerable<IVisualStudioInstallation> GetVisualStudioInstallations()
|
|
{
|
|
#if UNITY_EDITOR_WIN
|
|
foreach (var installation in VisualStudioForWindowsInstallation.GetVisualStudioInstallations())
|
|
yield return installation;
|
|
#elif UNITY_EDITOR_OSX
|
|
foreach (var installation in VisualStudioForMacInstallation.GetVisualStudioInstallations())
|
|
yield return installation;
|
|
#endif
|
|
|
|
foreach (var installation in VisualStudioCodeInstallation.GetVisualStudioInstallations())
|
|
yield return installation;
|
|
}
|
|
|
|
public static bool TryDiscoverInstallation(string editorPath, out IVisualStudioInstallation installation)
|
|
{
|
|
try
|
|
{
|
|
#if UNITY_EDITOR_WIN
|
|
if (VisualStudioForWindowsInstallation.TryDiscoverInstallation(editorPath, out installation))
|
|
return true;
|
|
#elif UNITY_EDITOR_OSX
|
|
if (VisualStudioForMacInstallation.TryDiscoverInstallation(editorPath, out installation))
|
|
return true;
|
|
#endif
|
|
if (VisualStudioCodeInstallation.TryDiscoverInstallation(editorPath, out installation))
|
|
return true;
|
|
}
|
|
catch (IOException)
|
|
{
|
|
installation = null;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
public static void Initialize()
|
|
{
|
|
#if UNITY_EDITOR_WIN
|
|
VisualStudioForWindowsInstallation.Initialize();
|
|
#elif UNITY_EDITOR_OSX
|
|
VisualStudioForMacInstallation.Initialize();
|
|
#endif
|
|
VisualStudioCodeInstallation.Initialize();
|
|
}
|
|
}
|
|
}
|