From d7299a1afdb2a8a3f25e52b46f1415f2dc56e604 Mon Sep 17 00:00:00 2001 From: Polianin Nikita Date: Tue, 28 May 2024 06:48:23 +0300 Subject: [PATCH] feat: add wrapper for Path.Combine with default path --- Endpoint/Common/Services/PathBuilder.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 Endpoint/Common/Services/PathBuilder.cs diff --git a/Endpoint/Common/Services/PathBuilder.cs b/Endpoint/Common/Services/PathBuilder.cs new file mode 100644 index 0000000..7df60d8 --- /dev/null +++ b/Endpoint/Common/Services/PathBuilder.cs @@ -0,0 +1,11 @@ +using System; +using System.IO; +using System.Linq; + +namespace Mirea.Api.Endpoint.Common.Services; + +public static class PathBuilder +{ + public static string PathToSave => Environment.GetEnvironmentVariable("PATH_TO_SAVE") ?? Directory.GetCurrentDirectory(); + public static string Combine(params string[] paths) => Path.Combine([.. paths.Prepend(PathToSave)]); +} \ No newline at end of file