Add support for selectable assets directory in GUI

This commit is contained in:
Tyrrrz
2023-02-17 21:30:10 +02:00
parent 95115f3e99
commit d1647e8286
9 changed files with 159 additions and 87 deletions

View File

@@ -98,20 +98,20 @@ public abstract class ExportCommandBase : TokenCommandBase
)]
public bool ShouldReuseAssets { get; init; }
private readonly string? _assetsPath;
private readonly string? _assetsDirPath;
[CommandOption(
"media-dir",
Description = "Download assets to this directory."
Description = "Download assets to this directory. If not specified, the asset directory path will be derived from the output path."
)]
public string? AssetsPath
public string? AssetsDirPath
{
get => _assetsPath;
get => _assetsDirPath;
// Handle ~/ in paths on Unix systems
// https://github.com/Tyrrrz/DiscordChatExporter/pull/903
init => _assetsPath = value is not null ? Path.GetFullPath(value) : null;
init => _assetsDirPath = value is not null ? Path.GetFullPath(value) : null;
}
[CommandOption(
"dateformat",
Description = "Format used when writing dates."
@@ -139,7 +139,7 @@ public abstract class ExportCommandBase : TokenCommandBase
}
// Assets directory should only be specified when the download assets option is set
if (!string.IsNullOrWhiteSpace(AssetsPath) && !ShouldDownloadAssets)
if (!string.IsNullOrWhiteSpace(AssetsDirPath) && !ShouldDownloadAssets)
{
throw new CommandException(
"Option --media-dir cannot be used without --media."
@@ -194,7 +194,7 @@ public abstract class ExportCommandBase : TokenCommandBase
guild,
channel,
OutputPath,
AssetsPath,
AssetsDirPath,
ExportFormat,
After,
Before,