From 188dc4b3b6102f065cc928931a9670dcf4fd2a78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20L=C3=BCbe=C3=9F?= Date: Sat, 15 Aug 2026 13:52:33 +0200 Subject: [PATCH] Better names for found Rider installs + context menu for copy/open path --- .../RiderPathLocator/RiderPathLocator.bf | 9 +++++-- .../RiderPathLocatorWindows.bf | 12 ++++++++-- .../src/Settings/DetectIDEsBackgroundTask.bf | 2 +- GlitchyEditor/src/Settings/Settings.bf | 24 +++++++++++++++++++ 4 files changed, 42 insertions(+), 5 deletions(-) diff --git a/GlitchyEditor/src/CodeEditors/RiderPathLocator/RiderPathLocator.bf b/GlitchyEditor/src/CodeEditors/RiderPathLocator/RiderPathLocator.bf index 0f2dafe..d310b24 100644 --- a/GlitchyEditor/src/CodeEditors/RiderPathLocator/RiderPathLocator.bf +++ b/GlitchyEditor/src/CodeEditors/RiderPathLocator/RiderPathLocator.bf @@ -123,12 +123,14 @@ class RiderInstallInfo public String Path ~ delete _; public RiderVersion Version; 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); Version = version; 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". - protected static RiderVersion ParseProductInfoJson(StringView productInfoJsonPath) + protected static RiderVersion ParseProductInfoJson(StringView productInfoJsonPath, String outName, String outVersion) { StructuredData data = scope .(); if (data.Load(productInfoJsonPath) case .Err) @@ -374,6 +376,9 @@ static class RiderPathLocator String buildNumber = scope .(); data.GetString("buildNumber", buildNumber); + + data.GetString("name", outName); + data.GetString("version", outVersion); return RiderVersion.Parse(buildNumber); } diff --git a/GlitchyEditor/src/CodeEditors/RiderPathLocator/RiderPathLocatorWindows.bf b/GlitchyEditor/src/CodeEditors/RiderPathLocator/RiderPathLocatorWindows.bf index 6097016..e915c80 100644 --- a/GlitchyEditor/src/CodeEditors/RiderPathLocator/RiderPathLocatorWindows.bf +++ b/GlitchyEditor/src/CodeEditors/RiderPathLocator/RiderPathLocatorWindows.bf @@ -33,11 +33,19 @@ extension RiderPathLocator RiderVersion version = .(); + String installName = scope .(); + String installVersion = scope .(); + String productInfoPath = scope .(); Path.Combine(productInfoPath, riderDirectory, "product-info.json"); if (File.Exists(productInfoPath)) - version = ParseProductInfoJson(productInfoPath); + version = ParseProductInfoJson(productInfoPath, installName, installVersion); + else + { + installName.Set("Rider"); + version.ToString(installVersion..Clear()); + } if (!version.IsInitialized) { @@ -49,7 +57,7 @@ extension RiderPathLocator 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 outInstalls) diff --git a/GlitchyEditor/src/Settings/DetectIDEsBackgroundTask.bf b/GlitchyEditor/src/Settings/DetectIDEsBackgroundTask.bf index f4905af..76c0f1d 100644 --- a/GlitchyEditor/src/Settings/DetectIDEsBackgroundTask.bf +++ b/GlitchyEditor/src/Settings/DetectIDEsBackgroundTask.bf @@ -183,7 +183,7 @@ class DetectIDEsBackgroundTask : BackgroundTask ide.IsAutoDetected = true; ide.Ide = .Rider; ide.Path = install.Path; - ide.Name = scope $"Rider {install.Version}"; + ide.Name = install.Name; installations.Add(ide); } diff --git a/GlitchyEditor/src/Settings/Settings.bf b/GlitchyEditor/src/Settings/Settings.bf index 7d81053..29bc89c 100644 --- a/GlitchyEditor/src/Settings/Settings.bf +++ b/GlitchyEditor/src/Settings/Settings.bf @@ -290,6 +290,9 @@ class ScriptSettings { 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) { _activeIdePath.Set(ide.Path); @@ -297,6 +300,27 @@ class ScriptSettings } 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(); } }