Skip to content

Commit

Permalink
Merge pull request #78832 from van800/path_locator_4x
Browse files Browse the repository at this point in the history
Update the RiderPathLocator to support the JetBrains Toolbox 2.0
  • Loading branch information
akien-mga committed Jul 8, 2023
2 parents 43c0fa7 + bf3af9f commit 4a3c662
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 476 deletions.
3 changes: 1 addition & 2 deletions modules/mono/editor/GodotTools/GodotTools/GodotTools.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2019.1.3.0" ExcludeAssets="runtime" PrivateAssets="all" />
<PackageReference Include="JetBrains.Rider.PathLocator" Version="1.0.1" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<!-- For RiderPathLocator -->
<PackageReference Include="Microsoft.Win32.Registry" Version="5.0.0" />
<Reference Include="GodotSharp">
<HintPath>$(GodotApiAssembliesDir)/GodotSharp.dll</HintPath>
<Private>False</Private>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
using System;
using Godot;
using JetBrains.Rider.PathLocator;
using Newtonsoft.Json;
using OS = GodotTools.Utils.OS;

namespace GodotTools.Ides.Rider;

public class RiderLocatorEnvironment : IRiderLocatorEnvironment
{
public JetBrains.Rider.PathLocator.OS CurrentOS
{
get
{
if (OS.IsWindows)
return JetBrains.Rider.PathLocator.OS.Windows;
if (OS.IsMacOS) return JetBrains.Rider.PathLocator.OS.MacOSX;
if (OS.IsUnixLike) return JetBrains.Rider.PathLocator.OS.Linux;
return JetBrains.Rider.PathLocator.OS.Other;
}
}

public T FromJson<T>(string json)
{
return JsonConvert.DeserializeObject<T>(json);
}

public void Info(string message, Exception e = null)
{
if (e == null)
GD.Print(message);
else
GD.Print(message, e);
}

public void Warn(string message, Exception e = null)
{
if (e == null)
GD.PushWarning(message);
else
GD.PushWarning(message, e);
}

public void Error(string message, Exception e = null)
{
if (e == null)
GD.PushError(message);
else
GD.PushError(message, e);
}
}
Loading

0 comments on commit 4a3c662

Please sign in to comment.