summaryrefslogtreecommitdiffstats
path: root/src/server/Models/General/AppPath.cs
blob: 063fafe1f898a3ed1e6c665710fcab2b9a7a1b68 (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
namespace IOL.BookmarkThing.Server.Models.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);
	}
}