aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJP Dillingham <jpdillingham@gmail.com>2021-08-19 08:01:56 -0500
committerJP Dillingham <jpdillingham@gmail.com>2021-08-19 08:01:56 -0500
commit9b4a2e5f8a1eb2ad62525197aad0600cf5c00de4 (patch)
treef5ac22f5ae77d0314362d3bd4d2bea60c5500666 /src
parent36cae2c5e9f3a53f2e229790d594acacfa1cb3db (diff)
downloadslskd-9b4a2e5f8a1eb2ad62525197aad0600cf5c00de4.tar.gz
default shares to an empty array. warn if no shares are configured
Diffstat (limited to 'src')
-rw-r--r--src/slskd/Application/SharedFileCache.cs5
-rw-r--r--src/slskd/Options.cs2
-rw-r--r--src/slskd/Program.cs6
3 files changed, 6 insertions, 7 deletions
diff --git a/src/slskd/Application/SharedFileCache.cs b/src/slskd/Application/SharedFileCache.cs
index 3f050086..4e0d5cd0 100644
--- a/src/slskd/Application/SharedFileCache.cs
+++ b/src/slskd/Application/SharedFileCache.cs
@@ -137,6 +137,11 @@ namespace slskd
.OrderByDescending(share => share.LocalPath.Length) // process subdirectories first. this allows them to be aliased separately from their parent
.ToList();
+ if (!Shares.Any())
+ {
+ Log.Warning("Aborting shared file scan; no shares configured.");
+ }
+
Log.Debug("Enumerating shared directories");
swSnapshot = sw.ElapsedMilliseconds;
diff --git a/src/slskd/Options.cs b/src/slskd/Options.cs
index cd2dadd2..62bc0a6c 100644
--- a/src/slskd/Options.cs
+++ b/src/slskd/Options.cs
@@ -260,7 +260,7 @@ namespace slskd
[Argument('s', "shared")]
[EnvironmentVariable("SHARED_DIR")]
[Description("path to shared files")]
- public string[] Shared { get; private set; } = new[] { Program.DefaultSharedDirectory };
+ public string[] Shared { get; private set; } = Array.Empty<string>();
/// <summary>
/// Extended validation.
diff --git a/src/slskd/Program.cs b/src/slskd/Program.cs
index 8670b018..4489487a 100644
--- a/src/slskd/Program.cs
+++ b/src/slskd/Program.cs
@@ -74,11 +74,6 @@ namespace slskd
public static readonly string DefaultDownloadsDirectory = Path.Combine(DefaultAppDirectory, "downloads");
/// <summary>
- /// The default shared directory.
- /// </summary>
- public static readonly string DefaultSharedDirectory = Path.Combine(DefaultAppDirectory, "shared");
-
- /// <summary>
/// The global prefix for environment variables.
/// </summary>
public static readonly string EnvironmentVariablePrefix = $"{AppName.ToUpperInvariant()}_";
@@ -241,7 +236,6 @@ namespace slskd
VerifyDirectory(OptionsAtStartup.Directories.App, createIfMissing: true, verifyWriteable: true);
VerifyDirectory(OptionsAtStartup.Directories.Incomplete, createIfMissing: true, verifyWriteable: true);
VerifyDirectory(OptionsAtStartup.Directories.Downloads, createIfMissing: true, verifyWriteable: true);
- VerifyDirectory(DefaultSharedDirectory, createIfMissing: true, verifyWriteable: false);
}
catch (Exception ex)
{