From add94527050dc311c4ad117e25dd5e4517b3b887 Mon Sep 17 00:00:00 2001 From: ivarlovlie Date: Tue, 15 Nov 2022 11:05:05 +0700 Subject: feat: Initial commit --- src/Models/AppPath.cs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/Models/AppPath.cs (limited to 'src/Models/AppPath.cs') diff --git a/src/Models/AppPath.cs b/src/Models/AppPath.cs new file mode 100644 index 0000000..2133f20 --- /dev/null +++ b/src/Models/AppPath.cs @@ -0,0 +1,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); + } +} \ No newline at end of file -- cgit v1.3