From db5bb0aec988fa961d3f2370f9f52d702d22b679 Mon Sep 17 00:00:00 2001 From: leo Date: Sat, 31 May 2025 21:26:01 +0800 Subject: [PATCH] fix: must convert the relative path to absolute before send it to first instance (#1376) Signed-off-by: leo --- src/App.axaml.cs | 12 +++++++++++- src/Models/Statistics.cs | 4 ++-- src/Views/ChangeStatusIcon.cs | 2 +- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/App.axaml.cs b/src/App.axaml.cs index 0664ee25..411f5cfb 100644 --- a/src/App.axaml.cs +++ b/src/App.axaml.cs @@ -393,7 +393,17 @@ namespace SourceGit _ipcChannel = new Models.IpcChannel(); if (!_ipcChannel.IsFirstInstance) { - _ipcChannel.SendToFirstInstance(desktop.Args is { Length: 1 } ? desktop.Args[0] : string.Empty); + var arg = desktop.Args is { Length: > 0 } ? desktop.Args[0].Trim() : string.Empty; + if (!string.IsNullOrEmpty(arg)) + { + if (arg.StartsWith('"') && arg.EndsWith('"')) + arg = arg.Substring(1, arg.Length - 2).Trim(); + + if (arg.Length > 0 && !Path.IsPathFullyQualified(arg)) + arg = Path.GetFullPath(arg); + } + + _ipcChannel.SendToFirstInstance(arg); Environment.Exit(0); } else diff --git a/src/Models/Statistics.cs b/src/Models/Statistics.cs index d6f5870d..a86380c3 100644 --- a/src/Models/Statistics.cs +++ b/src/Models/Statistics.cs @@ -220,12 +220,12 @@ namespace SourceGit.Models public void Complete() { _users.Clear(); - + All.Complete(); Month.Complete(); Week.Complete(); } - + private readonly DateTime _thisMonthStart; private readonly DateTime _thisWeekStart; private readonly Dictionary _users = new(); diff --git a/src/Views/ChangeStatusIcon.cs b/src/Views/ChangeStatusIcon.cs index ade46537..0f0e8da1 100644 --- a/src/Views/ChangeStatusIcon.cs +++ b/src/Views/ChangeStatusIcon.cs @@ -135,7 +135,7 @@ namespace SourceGit.Views else { ToolTip.SetTip(this, TIPS[(int)c.Index]); - } + } InvalidateVisual(); }