From 9e5195492eb34171b6751c017ee67557ec181a1d Mon Sep 17 00:00:00 2001 From: goaaats Date: Wed, 26 Nov 2025 21:07:49 +0100 Subject: [PATCH] Get active track from env var, instead of git branch --- Dalamud/Interface/Internal/DalamudInterface.cs | 2 +- .../Internal/Windows/BranchSwitcherWindow.cs | 10 ++++++---- Dalamud/Utility/Util.cs | 16 +++++++++++++--- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/Dalamud/Interface/Internal/DalamudInterface.cs b/Dalamud/Interface/Internal/DalamudInterface.cs index f2ffc7a4c..202334580 100644 --- a/Dalamud/Interface/Internal/DalamudInterface.cs +++ b/Dalamud/Interface/Internal/DalamudInterface.cs @@ -1060,7 +1060,7 @@ internal class DalamudInterface : IInternalDisposableService { ImGui.PushFont(InterfaceManager.MonoFont); - ImGui.BeginMenu(Util.GetBranch() ?? "???", false); + ImGui.BeginMenu($"{Util.GetActiveTrack() ?? "???"} on {Util.GetGitBranch() ?? "???"}", false); ImGui.BeginMenu($"{Util.GetScmVersion()}", false); ImGui.BeginMenu(this.FrameCount.ToString("000000"), false); ImGui.BeginMenu(ImGui.GetIO().Framerate.ToString("000"), false); diff --git a/Dalamud/Interface/Internal/Windows/BranchSwitcherWindow.cs b/Dalamud/Interface/Internal/Windows/BranchSwitcherWindow.cs index da6217aca..51ff3bdcd 100644 --- a/Dalamud/Interface/Internal/Windows/BranchSwitcherWindow.cs +++ b/Dalamud/Interface/Internal/Windows/BranchSwitcherWindow.cs @@ -46,10 +46,12 @@ public class BranchSwitcherWindow : Window this.branches = await client.GetFromJsonAsync>(BranchInfoUrl); Debug.Assert(this.branches != null, "this.branches != null"); - var branch = Util.GetBranch(); - this.selectedBranchIndex = this.branches!.Any(x => x.Value.Track == branch) ? - this.branches.TakeWhile(x => x.Value.Track != branch).Count() - : 0; + var trackName = Util.GetActiveTrack(); + this.selectedBranchIndex = this.branches.IndexOf(x => x.Value.Track != trackName); + if (this.selectedBranchIndex == -1) + { + this.selectedBranchIndex = 0; + } }); base.OnOpen(); diff --git a/Dalamud/Utility/Util.cs b/Dalamud/Utility/Util.cs index 2a3733303..19610ef64 100644 --- a/Dalamud/Utility/Util.cs +++ b/Dalamud/Utility/Util.cs @@ -140,10 +140,10 @@ public static partial class Util } /// - /// Gets the Dalamud branch name this version of Dalamud was built from, or null, if this is a Debug build. + /// Gets the Git branch name this version of Dalamud was built from, or null, if this is a Debug build. /// /// The branch name. - public static string? GetBranch() + public static string? GetGitBranch() { if (branchInternal != null) return branchInternal; @@ -155,7 +155,17 @@ public static partial class Util if (gitBranch == null) return null; - return branchInternal = gitBranch == "master" ? "release" : gitBranch; + return branchInternal = gitBranch; + } + + /// + /// Gets the active Dalamud track, if this instance was launched through XIVLauncher and used a version + /// downloaded from webservices. + /// + /// The name of the track, or null. + internal static string? GetActiveTrack() + { + return Environment.GetEnvironmentVariable("DALAMUD_BRANCH"); } ///