diff options
| author | ivarlovlie <git@ivarlovlie.no> | 2022-12-09 05:14:52 +0100 |
|---|---|---|
| committer | ivarlovlie <git@ivarlovlie.no> | 2022-12-09 05:14:52 +0100 |
| commit | 036f11cdc0f99fd86f576f5335dae844391a0283 (patch) | |
| tree | d507c039443742420e34e0205a4292730b5c908d /code/api/src/Models/Misc/AppPath.cs | |
| parent | 389bbdf248273ee649a0a30fd65bdc60c6afb5b7 (diff) | |
| download | greatoffice-036f11cdc0f99fd86f576f5335dae844391a0283.tar.xz greatoffice-036f11cdc0f99fd86f576f5335dae844391a0283.zip | |
feat: Move /Data into /Models
Diffstat (limited to 'code/api/src/Models/Misc/AppPath.cs')
| -rw-r--r-- | code/api/src/Models/Misc/AppPath.cs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/code/api/src/Models/Misc/AppPath.cs b/code/api/src/Models/Misc/AppPath.cs new file mode 100644 index 0000000..e47e48c --- /dev/null +++ b/code/api/src/Models/Misc/AppPath.cs @@ -0,0 +1,23 @@ +namespace IOL.GreatOffice.Api.Data.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); + } +} |
