From 2315ccac2306caff3942916326d1569886cfa4e8 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sat, 14 May 2022 20:40:08 -0500 Subject: improve logging of shares --- src/slskd/Shares/SharedFileCache.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/slskd/Shares/SharedFileCache.cs b/src/slskd/Shares/SharedFileCache.cs index 3e305f08..ac996fa6 100644 --- a/src/slskd/Shares/SharedFileCache.cs +++ b/src/slskd/Shares/SharedFileCache.cs @@ -199,11 +199,13 @@ namespace slskd.Shares Log.Warning("Aborting shared file scan; no shares configured."); } - foreach (var share in Shares) - { - Log.Information($"Sharing {share.LocalPath} as {share.RemotePath}"); - Log.Debug($"Raw: {share.Raw}, Alias: {share.Alias}, Mask: {share.Mask}, Remote: {share.RemotePath})"); - } + Shares.ForEach(s => Log.Debug(s.ToJson())); + + Shares.Where(s => !s.IsExcluded).ToList() + .ForEach(s => Log.Information("Sharing {Local} as {Remote}", s.LocalPath, s.RemotePath)); + + Shares.Where(s => s.IsExcluded).ToList() + .ForEach(s => Log.Information("Excluding {Local}", s.LocalPath)); Log.Debug("Enumerating shared directories"); swSnapshot = sw.ElapsedMilliseconds; -- cgit v1.2.3 From 7caa8e13b7dfefa76dee92897f459514f2983e6b Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sat, 14 May 2022 20:46:29 -0500 Subject: account for exclusions when validating shares --- src/slskd/Options.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/slskd/Options.cs b/src/slskd/Options.cs index a1493ca4..a8c3380c 100644 --- a/src/slskd/Options.cs +++ b/src/slskd/Options.cs @@ -342,7 +342,7 @@ namespace slskd bool IsRoot((string Raw, string Mask, string Alias, string Path) share) => share.Path == "/" || share.Path == "\\" || Path.GetPathRoot(share.Path) == share.Path; // starts with '/', 'X:\', or '\\' - bool IsAbsolutePath(string share) => Regex.IsMatch(share.ToLocalOSPath(), @"^(\[.*\])?(\/|[a-zA-Z]:\\|\\\\).*$"); + bool IsAbsolutePath(string share) => Regex.IsMatch(share.ToLocalOSPath(), @"^(!|-){0,1}(\[.*\])?(\/|[a-zA-Z]:\\|\\\\).*$"); var relativePaths = Shared.Where(share => !IsAbsolutePath(share)); foreach (var relativePath in relativePaths) -- cgit v1.2.3