From 42a2cc1747c7859c63334a7a45792e0af1410e1a Mon Sep 17 00:00:00 2001 From: cvium Date: Mon, 24 May 2021 00:30:41 +0200 Subject: Remove some unnecessary allocations --- Emby.Server.Implementations/ServerApplicationPaths.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'Emby.Server.Implementations/ServerApplicationPaths.cs') 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"); } /// /// Gets the path to the base root media directory. /// /// The root folder path. - public string RootFolderPath => Path.Combine(ProgramDataPath, "root"); + public string RootFolderPath { get; } /// /// Gets the path to the default user view directory. Used if no specific user view is defined. /// /// The default user views path. - public string DefaultUserViewsPath => Path.Combine(RootFolderPath, "default"); + public string DefaultUserViewsPath { get; } /// /// Gets the path to the People directory. @@ -98,7 +102,7 @@ namespace Emby.Server.Implementations public string UserConfigurationDirectoryPath => Path.Combine(ConfigurationDirectoryPath, "users"); /// - public string DefaultInternalMetadataPath => Path.Combine(ProgramDataPath, "metadata"); + public string DefaultInternalMetadataPath { get; } /// public string InternalMetadataPath { get; set; } -- cgit v1.2.3 From 1580bf5469bdd517c5451f213500cf8af235c5f1 Mon Sep 17 00:00:00 2001 From: cvium Date: Mon, 24 May 2021 08:03:24 +0200 Subject: Fix property instantiation order --- Emby.Server.Implementations/ServerApplicationPaths.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Emby.Server.Implementations/ServerApplicationPaths.cs') diff --git a/Emby.Server.Implementations/ServerApplicationPaths.cs b/Emby.Server.Implementations/ServerApplicationPaths.cs index d5483bf40..6cf9a8f71 100644 --- a/Emby.Server.Implementations/ServerApplicationPaths.cs +++ b/Emby.Server.Implementations/ServerApplicationPaths.cs @@ -25,11 +25,11 @@ namespace Emby.Server.Implementations cacheDirectoryPath, 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"); + InternalMetadataPath = DefaultInternalMetadataPath; } /// -- cgit v1.2.3