diff --git a/src/Trash/AppPaths.cs b/src/Trash/AppPaths.cs new file mode 100644 index 00000000..b2e6cfee --- /dev/null +++ b/src/Trash/AppPaths.cs @@ -0,0 +1,13 @@ +using System; +using System.IO; + +namespace Trash +{ + internal static class AppPaths + { + public static string AppDataPath { get; } = + Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "trash-updater"); + + public static string DefaultConfigPath { get; } = Path.Join(AppContext.BaseDirectory, "trash.yml"); + } +} diff --git a/src/Trash/Command/ServiceCommand.cs b/src/Trash/Command/ServiceCommand.cs index 66277971..e342d138 100644 --- a/src/Trash/Command/ServiceCommand.cs +++ b/src/Trash/Command/ServiceCommand.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.IO; using System.Threading.Tasks; using CliFx; using CliFx.Attributes; @@ -70,7 +69,7 @@ namespace Trash.Command [CommandOption("config", 'c', Description = "One or more YAML config files to use. All configs will be used and settings are additive. " + "If not specified, the script will look for `trash.yml` in the same directory as the executable.")] - public List Config { get; [UsedImplicitly] set; } = new() {DefaultConfigPath}; + public List Config { get; [UsedImplicitly] set; } = new() {AppPaths.DefaultConfigPath}; private void SetupLogging() { diff --git a/src/Trash/CreateConfig/CreateConfigCommand.cs b/src/Trash/CreateConfig/CreateConfigCommand.cs index 9977660c..1d66c4b8 100644 --- a/src/Trash/CreateConfig/CreateConfigCommand.cs +++ b/src/Trash/CreateConfig/CreateConfigCommand.cs @@ -7,7 +7,6 @@ using CliFx.Infrastructure; using Common; using JetBrains.Annotations; using Serilog; -using Trash.Command; namespace Trash.CreateConfig { @@ -29,7 +28,7 @@ namespace Trash.CreateConfig "Path where the new YAML file should be created. Must include the filename (e.g. path/to/config.yml). " + "File must not already exist. If not specified, uses the default path of `trash.yml` right next to the " + "executable.")] - public string Path { get; [UsedImplicitly] set; } = ServiceCommand.DefaultConfigPath; + public string Path { get; [UsedImplicitly] set; } = AppPaths.DefaultConfigPath; public ValueTask ExecuteAsync(IConsole console) {