enhance: unified all file-path normalization - use char-replace, trim trailing slash

This commit is contained in:
Göran W 2025-06-03 16:45:00 +02:00 committed by leo
parent 54c05ac35a
commit 88c38b4139
No known key found for this signature in database
8 changed files with 15 additions and 17 deletions

View file

@ -780,7 +780,7 @@ namespace SourceGit.ViewModels
byParentFolder.IsVisible = !isRooted;
byParentFolder.Click += (_, e) =>
{
var dir = Path.GetDirectoryName(change.Path)!.Replace("\\", "/");
var dir = Path.GetDirectoryName(change.Path)!.Replace('\\', '/').TrimEnd('/');
Commands.GitIgnore.Add(_repo.FullPath, dir + "/");
e.Handled = true;
};
@ -802,7 +802,7 @@ namespace SourceGit.ViewModels
byExtensionInSameFolder.IsVisible = !isRooted;
byExtensionInSameFolder.Click += (_, e) =>
{
var dir = Path.GetDirectoryName(change.Path)!.Replace("\\", "/");
var dir = Path.GetDirectoryName(change.Path)!.Replace('\\', '/').TrimEnd('/');
Commands.GitIgnore.Add(_repo.FullPath, $"{dir}/*{extension}");
e.Handled = true;
};