From 810f8660bcc435bfb6dd4e1be99b8194462b263a Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sat, 21 Aug 2021 07:25:30 -0500 Subject: stop replacing forward slashes in file paths --- src/slskd/Application/SharedFileCache.cs | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/slskd/Application/SharedFileCache.cs b/src/slskd/Application/SharedFileCache.cs index 5ef9be64..06442797 100644 --- a/src/slskd/Application/SharedFileCache.cs +++ b/src/slskd/Application/SharedFileCache.cs @@ -99,12 +99,7 @@ namespace slskd directories.AddOrUpdate(group.Name, group, (_, _) => group); } - Console.WriteLine(directories.Values.ToJson()); - - return directories.Values.OrderBy(f => { - Console.WriteLine($"Sorting by {f.Name}"); - return f.Name[8..]; - }); + return directories.Values.OrderBy(f => f.Name[8..]); } /// @@ -191,7 +186,7 @@ namespace slskd try { var newFiles = System.IO.Directory.GetFiles(directory, "*", SearchOption.TopDirectoryOnly) - .Select(f => new File(1, f.Replace("/", @"\").ReplaceFirst(share.LocalPath, share.RemotePath), new FileInfo(f).Length, Path.GetExtension(f))) + .Select(f => new File(1, f.ReplaceFirst(share.LocalPath, share.RemotePath), new FileInfo(f).Length, Path.GetExtension(f))) .ToDictionary(f => f.Filename, f => f); // merge the new dictionary with the rest this will overwrite any duplicate keys, but keys are the fully @@ -373,15 +368,8 @@ namespace slskd var maskedPath = LocalPath.ReplaceFirst(System.IO.Directory.GetParent(LocalPath).FullName, Mask); - if (!string.IsNullOrEmpty(Alias)) - { - var aliasedSegment = LocalPath[(System.IO.Directory.GetParent(LocalPath).FullName.Length + 1)..]; - RemotePath = maskedPath.ReplaceFirst(aliasedSegment, Alias); - } - else - { - RemotePath = LocalPath.ReplaceFirst(System.IO.Directory.GetParent(LocalPath).FullName, Mask); - } + var aliasedSegment = LocalPath[(System.IO.Directory.GetParent(LocalPath).FullName.Length + 1)..]; + RemotePath = maskedPath.ReplaceFirst(aliasedSegment, Alias); } public string Alias { get; init; } -- cgit v1.2.3