aboutsummaryrefslogtreecommitdiffstats
path: root/src/Models/AppPath.cs
blob: 2133f20f1352bd779ca505a23b092c79c9480bba (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
namespace I2R.LightNews.Models;

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);
    }
}