mirror of
https://fastgit.cc/github.com/sourcegit-scm/sourcegit
synced 2026-04-30 13:51:53 +08:00
enhance: unified all file-path normalization - use char-replace, trim trailing slash
This commit is contained in:
@@ -46,11 +46,11 @@ namespace SourceGit.ViewModels
|
||||
|
||||
Dispatcher.UIThread.Invoke(() =>
|
||||
{
|
||||
var normalizedRoot = rootDir.FullName.Replace("\\", "/").TrimEnd('/');
|
||||
var normalizedRoot = rootDir.FullName.Replace('\\', '/').TrimEnd('/');
|
||||
|
||||
foreach (var f in found)
|
||||
{
|
||||
var parent = new DirectoryInfo(f.Path).Parent!.FullName.Replace("\\", "/").TrimEnd('/');
|
||||
var parent = new DirectoryInfo(f.Path).Parent!.FullName.Replace('\\', '/').TrimEnd('/');
|
||||
if (parent.Equals(normalizedRoot, StringComparison.Ordinal))
|
||||
{
|
||||
Preferences.Instance.FindOrAddNodeByRepositoryPath(f.Path, null, false);
|
||||
@@ -93,7 +93,7 @@ namespace SourceGit.ViewModels
|
||||
|
||||
CallUIThread(() => ProgressDescription = $"Scanning {subdir.FullName}...");
|
||||
|
||||
var normalizedSelf = subdir.FullName.Replace("\\", "/").TrimEnd('/');
|
||||
var normalizedSelf = subdir.FullName.Replace('\\', '/').TrimEnd('/');
|
||||
if (_managed.Contains(normalizedSelf))
|
||||
continue;
|
||||
|
||||
@@ -103,7 +103,7 @@ namespace SourceGit.ViewModels
|
||||
var test = new Commands.QueryRepositoryRootPath(subdir.FullName).ReadToEnd();
|
||||
if (test.IsSuccess && !string.IsNullOrEmpty(test.StdOut))
|
||||
{
|
||||
var normalized = test.StdOut.Trim().Replace("\\", "/").TrimEnd('/');
|
||||
var normalized = test.StdOut.Trim().Replace('\\', '/').TrimEnd('/');
|
||||
if (!_managed.Contains(normalized))
|
||||
outs.Add(new FoundRepository(normalized, false));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user