diff options
| author | ivarlovlie <git@ivarlovlie.no> | 2022-01-22 22:43:38 +0100 |
|---|---|---|
| committer | ivarlovlie <git@ivarlovlie.no> | 2022-01-22 22:43:38 +0100 |
| commit | 88110f536f9c3843ecf5016122e101f8a424af77 (patch) | |
| tree | e8be4e77ccfb5ad37f49f89adad59ff12b4c85ea /src/server/Models/General/AppPath.cs | |
| download | bookmark-thing-88110f536f9c3843ecf5016122e101f8a424af77.tar.xz bookmark-thing-88110f536f9c3843ecf5016122e101f8a424af77.zip | |
Initial commit
Diffstat (limited to 'src/server/Models/General/AppPath.cs')
| -rw-r--r-- | src/server/Models/General/AppPath.cs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/server/Models/General/AppPath.cs b/src/server/Models/General/AppPath.cs new file mode 100644 index 0000000..063fafe --- /dev/null +++ b/src/server/Models/General/AppPath.cs @@ -0,0 +1,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); + } +} |
