aboutsummaryrefslogtreecommitdiffstats
path: root/src/slskd/Application/Service.cs
diff options
context:
space:
mode:
authorJP Dillingham <jpdillingham@gmail.com>2021-07-29 06:58:40 -0500
committerGitHub <noreply@github.com>2021-07-29 06:58:40 -0500
commitf22fff743ffcff1f71fccf738793255c5070ece7 (patch)
treeaf3c12d1180acff4ff5a8fb0af8632eb93d0e1e3 /src/slskd/Application/Service.cs
parent69d29c1eaa03992cf786d1d9b1ec1935dd85ef42 (diff)
parentc643d91c7feb9ab360539c17380e24673f0a102b (diff)
downloadslskd-f22fff743ffcff1f71fccf738793255c5070ece7.tar.gz
Merge pull request #132 from slskd/shares
Allow multiple shared directories
Diffstat (limited to 'src/slskd/Application/Service.cs')
-rw-r--r--src/slskd/Application/Service.cs15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/slskd/Application/Service.cs b/src/slskd/Application/Service.cs
index 1d2aec25..ef47cf24 100644
--- a/src/slskd/Application/Service.cs
+++ b/src/slskd/Application/Service.cs
@@ -19,6 +19,7 @@ namespace slskd
{
using System;
using System.Collections.Concurrent;
+ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
@@ -325,10 +326,16 @@ namespace slskd
/// <returns>A Task resolving an IEnumerable of Soulseek.Directory.</returns>
private Task<BrowseResponse> BrowseResponseResolver(string username, IPEndPoint endpoint)
{
- var directories = System.IO.Directory
- .GetDirectories(OptionsMonitor.CurrentValue.Directories.Shared, "*", SearchOption.AllDirectories)
- .Select(dir => new Soulseek.Directory(dir.Replace("/", @"\"), System.IO.Directory.GetFiles(dir)
- .Select(f => new Soulseek.File(1, Path.GetFileName(f), new FileInfo(f).Length, Path.GetExtension(f)))));
+ var shares = OptionsMonitor.CurrentValue.Directories.Shared;
+ var directories = new List<Soulseek.Directory>();
+
+ foreach (var share in shares)
+ {
+ directories.AddRange(System.IO.Directory
+ .GetDirectories(share, "*", SearchOption.AllDirectories)
+ .Select(dir => new Soulseek.Directory(dir.Replace("/", @"\"), System.IO.Directory.GetFiles(dir)
+ .Select(f => new Soulseek.File(1, Path.GetFileName(f), new FileInfo(f).Length, Path.GetExtension(f))))));
+ }
return Task.FromResult(new BrowseResponse(directories));
}