aboutsummaryrefslogtreecommitdiffstats
path: root/src/Data/General/AppPath.cs
blob: 241cf65c657705e5e2e01adb19b5a8e49cb09856 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
using System.IO;
using IOL.Helpers;

namespace IOL.WebApi.Template.Data.General
{
	public sealed record AppPath
	{
		public string HostPath { get; init; }
		public string WebPath { get; init; }

		public string GetHostPathForFilename(string filename, string fallback = "") {
			if (filename.IsNullOrWhiteSpace()) {
				return fallback;
			}

			return Path.Combine(HostPath, filename);
		}

		public string GetWebPathForFilename(string filename, string fallback = "") {
			if (filename.IsNullOrWhiteSpace()) {
				return fallback;
			}

			return Path.Combine(WebPath, filename);
		}
	}
}