summaryrefslogtreecommitdiffstats
path: root/src/Models/AppPath.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Models/AppPath.cs')
-rw-r--r--src/Models/AppPath.cs24
1 files changed, 24 insertions, 0 deletions
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