aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/ServerApplicationPaths.cs
diff options
context:
space:
mode:
authorcvium <clausvium@gmail.com>2021-05-24 00:30:41 +0200
committercvium <clausvium@gmail.com>2021-05-24 00:30:41 +0200
commit42a2cc1747c7859c63334a7a45792e0af1410e1a (patch)
tree16e9587342a83948ac6742f05518d9a31836c235 /Emby.Server.Implementations/ServerApplicationPaths.cs
parentdb9d3b8653d865459e5df5a2fba18f0c9462dbb6 (diff)
Remove some unnecessary allocations
Diffstat (limited to 'Emby.Server.Implementations/ServerApplicationPaths.cs')
-rw-r--r--Emby.Server.Implementations/ServerApplicationPaths.cs10
1 files changed, 7 insertions, 3 deletions
diff --git a/Emby.Server.Implementations/ServerApplicationPaths.cs b/Emby.Server.Implementations/ServerApplicationPaths.cs
index ac589b03c..d5483bf40 100644
--- a/Emby.Server.Implementations/ServerApplicationPaths.cs
+++ b/Emby.Server.Implementations/ServerApplicationPaths.cs
@@ -26,19 +26,23 @@ namespace Emby.Server.Implementations
webDirectoryPath)
{
InternalMetadataPath = DefaultInternalMetadataPath;
+ // ProgramDataPath cannot change when the server is running, so cache these to avoid allocations.
+ RootFolderPath = Path.Join(ProgramDataPath, "root");
+ DefaultUserViewsPath = Path.Combine(RootFolderPath, "default");
+ DefaultInternalMetadataPath = Path.Combine(ProgramDataPath, "metadata");
}
/// <summary>
/// Gets the path to the base root media directory.
/// </summary>
/// <value>The root folder path.</value>
- public string RootFolderPath => Path.Combine(ProgramDataPath, "root");
+ public string RootFolderPath { get; }
/// <summary>
/// Gets the path to the default user view directory. Used if no specific user view is defined.
/// </summary>
/// <value>The default user views path.</value>
- public string DefaultUserViewsPath => Path.Combine(RootFolderPath, "default");
+ public string DefaultUserViewsPath { get; }
/// <summary>
/// Gets the path to the People directory.
@@ -98,7 +102,7 @@ namespace Emby.Server.Implementations
public string UserConfigurationDirectoryPath => Path.Combine(ConfigurationDirectoryPath, "users");
/// <inheritdoc/>
- public string DefaultInternalMetadataPath => Path.Combine(ProgramDataPath, "metadata");
+ public string DefaultInternalMetadataPath { get; }
/// <inheritdoc />
public string InternalMetadataPath { get; set; }