Skip to content

Commit db5bb0a

Browse files
committed
fix: must convert the relative path to absolute before send it to first instance (#1376)
Signed-off-by: leo <[email protected]>
1 parent dd432c6 commit db5bb0a

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

src/App.axaml.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,17 @@ public override void OnFrameworkInitializationCompleted()
393393
_ipcChannel = new Models.IpcChannel();
394394
if (!_ipcChannel.IsFirstInstance)
395395
{
396-
_ipcChannel.SendToFirstInstance(desktop.Args is { Length: 1 } ? desktop.Args[0] : string.Empty);
396+
var arg = desktop.Args is { Length: > 0 } ? desktop.Args[0].Trim() : string.Empty;
397+
if (!string.IsNullOrEmpty(arg))
398+
{
399+
if (arg.StartsWith('"') && arg.EndsWith('"'))
400+
arg = arg.Substring(1, arg.Length - 2).Trim();
401+
402+
if (arg.Length > 0 && !Path.IsPathFullyQualified(arg))
403+
arg = Path.GetFullPath(arg);
404+
}
405+
406+
_ipcChannel.SendToFirstInstance(arg);
397407
Environment.Exit(0);
398408
}
399409
else

src/Models/Statistics.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,12 +220,12 @@ public void AddCommit(string author, double timestamp)
220220
public void Complete()
221221
{
222222
_users.Clear();
223-
223+
224224
All.Complete();
225225
Month.Complete();
226226
Week.Complete();
227227
}
228-
228+
229229
private readonly DateTime _thisMonthStart;
230230
private readonly DateTime _thisWeekStart;
231231
private readonly Dictionary<string, User> _users = new();

src/Views/ChangeStatusIcon.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs chang
135135
else
136136
{
137137
ToolTip.SetTip(this, TIPS[(int)c.Index]);
138-
}
138+
}
139139

140140
InvalidateVisual();
141141
}

0 commit comments

Comments
 (0)