diff options
| author | PloughPuff <ploughpuff@protonmail.com> | 2019-01-28 14:51:31 +0000 |
|---|---|---|
| committer | Bond-009 <bond.009@outlook.com> | 2019-01-31 18:56:34 +0100 |
| commit | ebd2a3008791ac4043a775d48f0971a554bd9ff4 (patch) | |
| tree | ee764dabd6b09221c535ec82cc1a1f9735b060e3 /Jellyfin.Server/Program.cs | |
| parent | fd361421b120b103b2abaf1e3b36c6715887afe4 (diff) | |
Accept single-hyphen usage and rename -programdatadir to -datadir
For backwards compatibility, modify the args[] strings to replace single-hyphens with double-hyphens before parsing.
Also rename -programdatadir to -datadir.
Diffstat (limited to 'Jellyfin.Server/Program.cs')
| -rw-r--r-- | Jellyfin.Server/Program.cs | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/Jellyfin.Server/Program.cs b/Jellyfin.Server/Program.cs index dbfd59ebf..2f7edee65 100644 --- a/Jellyfin.Server/Program.cs +++ b/Jellyfin.Server/Program.cs @@ -27,6 +27,7 @@ using ILogger = Microsoft.Extensions.Logging.ILogger; namespace Jellyfin.Server { using CommandLine; + using System.Text.RegularExpressions; public static class Program { @@ -37,6 +38,18 @@ namespace Jellyfin.Server public static async Task Main(string[] args) { + // For backwards compatibility. + // Modify any input arguments now which start with single-hyphen to POSIX standard + // double-hyphen to allow parsing by CommandLineParser package. + var pattern = @"^(-[^-\s]{2})"; // Match -xx, not -x, not --xx, not xx + var substitution = @"-$1"; // Prepend with additional single-hyphen + var regex = new Regex(pattern); + + for (var i = 0; i < args.Length; i++) + { + args[i] = regex.Replace(args[i], substitution); + } + // For CommandLine package, change default behaviour to output errors to stdout (instead of stderr) var parser = new Parser(config => config.HelpWriter = Console.Out); @@ -139,9 +152,9 @@ namespace Jellyfin.Server string programDataPath = Environment.GetEnvironmentVariable("JELLYFIN_DATA_PATH"); if (string.IsNullOrEmpty(programDataPath)) { - if (options.PathProgramData != null) + if (options.PathData != null) { - programDataPath = options.PathProgramData; + programDataPath = options.PathData; } else { |
