From 9cffbbc5ced91e16d79549e48ff3ffdab021fe71 Mon Sep 17 00:00:00 2001 From: TSRBerry <20988865+TSRBerry@users.noreply.github.com> Date: Thu, 18 Aug 2022 22:23:26 +0200 Subject: [PATCH] Expand tilde to home directory on *nix systems in output path (#903) --- .../Commands/Base/ExportCommandBase.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/DiscordChatExporter.Cli/Commands/Base/ExportCommandBase.cs b/DiscordChatExporter.Cli/Commands/Base/ExportCommandBase.cs index ba23c58..e741815 100644 --- a/DiscordChatExporter.Cli/Commands/Base/ExportCommandBase.cs +++ b/DiscordChatExporter.Cli/Commands/Base/ExportCommandBase.cs @@ -20,12 +20,20 @@ namespace DiscordChatExporter.Cli.Commands.Base; public abstract class ExportCommandBase : TokenCommandBase { + private string _outputPath = Directory.GetCurrentDirectory(); + [CommandOption( "output", 'o', Description = "Output file or directory path." )] - public string OutputPath { get; init; } = Directory.GetCurrentDirectory(); + public string OutputPath + { + get => _outputPath; + // Handle ~/ in paths on *nix systems + // https://github.com/Tyrrrz/DiscordChatExporter/pull/903 + init => _outputPath = Path.GetFullPath(value); + } [CommandOption( "format", @@ -211,4 +219,4 @@ public abstract class ExportCommandBase : TokenCommandBase return default; } -} \ No newline at end of file +}