Skip to content

Commit d48afd1

Browse files
committed
code_style: use normalized path for _gitCommonDir
Signed-off-by: leo <longshuang@msn.cn>
1 parent b7d643e commit d48afd1

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

src/App.axaml.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -748,10 +748,17 @@ private void Check4Update(bool manually = false)
748748

749749
private void ShowSelfUpdateResult(object data)
750750
{
751-
Dispatcher.UIThread.Post(async () =>
751+
try
752752
{
753-
await ShowDialog(new ViewModels.SelfUpdate { Data = data });
754-
});
753+
Dispatcher.UIThread.Invoke(async () =>
754+
{
755+
await ShowDialog(new ViewModels.SelfUpdate { Data = data });
756+
});
757+
}
758+
catch
759+
{
760+
// Ignore exceptions.
761+
}
755762
}
756763

757764
private string FixFontFamilyName(string input)

src/ViewModels/Repository.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,10 +432,12 @@ public Repository(bool isBare, string path, string gitDir)
432432
if (isWorktree)
433433
{
434434
var commonDir = File.ReadAllText(commonDirFile).Trim();
435-
if (!Path.IsPathRooted(commonDir))
435+
if (Path.IsPathRooted(commonDir))
436+
commonDir = new DirectoryInfo(commonDir).FullName;
437+
else
436438
commonDir = new DirectoryInfo(Path.Combine(GitDir, commonDir)).FullName;
437439

438-
_gitCommonDir = commonDir;
440+
_gitCommonDir = commonDir.Replace('\\', '/').TrimEnd('/');
439441
}
440442
else
441443
{

0 commit comments

Comments
 (0)