mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 13:01:52 +00:00
Better names for found Rider installs + context menu for copy/open path
This commit is contained in:
@@ -123,12 +123,14 @@ class RiderInstallInfo
|
|||||||
public String Path ~ delete _;
|
public String Path ~ delete _;
|
||||||
public RiderVersion Version;
|
public RiderVersion Version;
|
||||||
public RiderInstallType InstallType;
|
public RiderInstallType InstallType;
|
||||||
|
public String Name ~ delete _;
|
||||||
|
|
||||||
public this(StringView path, RiderVersion version, RiderInstallType installType)
|
public this(StringView path, RiderVersion version, RiderInstallType installType, StringView name)
|
||||||
{
|
{
|
||||||
Path = new String(path);
|
Path = new String(path);
|
||||||
Version = version;
|
Version = version;
|
||||||
InstallType = installType;
|
InstallType = installType;
|
||||||
|
Name = new String(name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -366,7 +368,7 @@ static class RiderPathLocator
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Reads the version of a Rider installation out of its "product-info.json".
|
/// Reads the version of a Rider installation out of its "product-info.json".
|
||||||
protected static RiderVersion ParseProductInfoJson(StringView productInfoJsonPath)
|
protected static RiderVersion ParseProductInfoJson(StringView productInfoJsonPath, String outName, String outVersion)
|
||||||
{
|
{
|
||||||
StructuredData data = scope .();
|
StructuredData data = scope .();
|
||||||
if (data.Load(productInfoJsonPath) case .Err)
|
if (data.Load(productInfoJsonPath) case .Err)
|
||||||
@@ -375,6 +377,9 @@ static class RiderPathLocator
|
|||||||
String buildNumber = scope .();
|
String buildNumber = scope .();
|
||||||
data.GetString("buildNumber", buildNumber);
|
data.GetString("buildNumber", buildNumber);
|
||||||
|
|
||||||
|
data.GetString("name", outName);
|
||||||
|
data.GetString("version", outVersion);
|
||||||
|
|
||||||
return RiderVersion.Parse(buildNumber);
|
return RiderVersion.Parse(buildNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,11 +33,19 @@ extension RiderPathLocator
|
|||||||
|
|
||||||
RiderVersion version = .();
|
RiderVersion version = .();
|
||||||
|
|
||||||
|
String installName = scope .();
|
||||||
|
String installVersion = scope .();
|
||||||
|
|
||||||
String productInfoPath = scope .();
|
String productInfoPath = scope .();
|
||||||
Path.Combine(productInfoPath, riderDirectory, "product-info.json");
|
Path.Combine(productInfoPath, riderDirectory, "product-info.json");
|
||||||
|
|
||||||
if (File.Exists(productInfoPath))
|
if (File.Exists(productInfoPath))
|
||||||
version = ParseProductInfoJson(productInfoPath);
|
version = ParseProductInfoJson(productInfoPath, installName, installVersion);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
installName.Set("Rider");
|
||||||
|
version.ToString(installVersion..Clear());
|
||||||
|
}
|
||||||
|
|
||||||
if (!version.IsInitialized)
|
if (!version.IsInitialized)
|
||||||
{
|
{
|
||||||
@@ -49,7 +57,7 @@ extension RiderPathLocator
|
|||||||
version = RiderVersion.Parse(directoryName);
|
version = RiderVersion.Parse(directoryName);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new RiderInstallInfo(riderExePath, version, installType);
|
return new RiderInstallInfo(riderExePath, version, installType, scope $"{installName} {installVersion}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static override void CollectAllPaths(List<RiderInstallInfo> outInstalls)
|
public static override void CollectAllPaths(List<RiderInstallInfo> outInstalls)
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ class DetectIDEsBackgroundTask : BackgroundTask
|
|||||||
ide.IsAutoDetected = true;
|
ide.IsAutoDetected = true;
|
||||||
ide.Ide = .Rider;
|
ide.Ide = .Rider;
|
||||||
ide.Path = install.Path;
|
ide.Path = install.Path;
|
||||||
ide.Name = scope $"Rider {install.Version}";
|
ide.Name = install.Name;
|
||||||
|
|
||||||
installations.Add(ide);
|
installations.Add(ide);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -290,6 +290,9 @@ class ScriptSettings
|
|||||||
{
|
{
|
||||||
for (let ide in installations)
|
for (let ide in installations)
|
||||||
{
|
{
|
||||||
|
// Make sure entries have unique IDs, even if two IDEs have the same name.
|
||||||
|
ImGui.PushID(ide.Path.ToScopeCStr!());
|
||||||
|
|
||||||
if (ImGui.Selectable(ide.Name.ToScopeCStr!()) && ActiveIde != ide)
|
if (ImGui.Selectable(ide.Name.ToScopeCStr!()) && ActiveIde != ide)
|
||||||
{
|
{
|
||||||
_activeIdePath.Set(ide.Path);
|
_activeIdePath.Set(ide.Path);
|
||||||
@@ -297,6 +300,27 @@ class ScriptSettings
|
|||||||
}
|
}
|
||||||
|
|
||||||
ImGui.AttachTooltip(ide.Path);
|
ImGui.AttachTooltip(ide.Path);
|
||||||
|
|
||||||
|
// Context menu when right-clicking the entry.
|
||||||
|
if (ImGui.BeginPopupContextItem())
|
||||||
|
{
|
||||||
|
if (ImGui.MenuItem("Copy path"))
|
||||||
|
{
|
||||||
|
ImGui.SetClipboardText(ide.Path.ToScopeCStr!());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ImGui.MenuItem("Show in file browser..."))
|
||||||
|
{
|
||||||
|
if (Path.OpenFolderAndSelectItem(ide.Path) case .Err)
|
||||||
|
{
|
||||||
|
Log.EngineLogger.Error("Failed to show path in file browser.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui.EndPopup();
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui.PopID();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user