Ensure metadata path is created on app startup, and also each time it is updated
This commit is contained in:
parent
cbd62e00a4
commit
7615cdc963
|
@ -67,11 +67,15 @@ namespace Emby.Server.Implementations.Configuration
|
|||
/// <summary>
|
||||
/// Updates the metadata path.
|
||||
/// </summary>
|
||||
/// <exception cref="UnauthorizedAccessException">If the directory does not exist, and the caller does not have the required permission to create it.</exception>
|
||||
/// <exception cref="NotSupportedException">If there is a custom path transcoding path specified, but it is invalid.</exception>
|
||||
/// <exception cref="IOException">If the directory does not exist, and it also could not be created.</exception>
|
||||
private void UpdateMetadataPath()
|
||||
{
|
||||
((ServerApplicationPaths)ApplicationPaths).InternalMetadataPath = string.IsNullOrWhiteSpace(Configuration.MetadataPath)
|
||||
? Path.Combine(ApplicationPaths.ProgramDataPath, "metadata")
|
||||
? ApplicationPaths.DefaultInternalMetadataPath
|
||||
: Configuration.MetadataPath;
|
||||
Directory.CreateDirectory(ApplicationPaths.InternalMetadataPath);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -9,8 +9,6 @@ namespace Emby.Server.Implementations
|
|||
/// </summary>
|
||||
public class ServerApplicationPaths : BaseApplicationPaths, IServerApplicationPaths
|
||||
{
|
||||
private string _internalMetadataPath;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ServerApplicationPaths" /> class.
|
||||
/// </summary>
|
||||
|
@ -27,6 +25,7 @@ namespace Emby.Server.Implementations
|
|||
cacheDirectoryPath,
|
||||
webDirectoryPath)
|
||||
{
|
||||
InternalMetadataPath = DefaultInternalMetadataPath;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -99,11 +98,10 @@ namespace Emby.Server.Implementations
|
|||
public string UserConfigurationDirectoryPath => Path.Combine(ConfigurationDirectoryPath, "users");
|
||||
|
||||
/// <inheritdoc/>
|
||||
public string InternalMetadataPath
|
||||
{
|
||||
get => _internalMetadataPath ?? (_internalMetadataPath = Path.Combine(DataPath, "metadata"));
|
||||
set => _internalMetadataPath = value;
|
||||
}
|
||||
public string DefaultInternalMetadataPath => Path.Combine(ProgramDataPath, "metadata");
|
||||
|
||||
/// <inheritdoc />
|
||||
public string InternalMetadataPath { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public string VirtualInternalMetadataPath { get; } = "%MetadataPath%";
|
||||
|
|
|
@ -71,7 +71,12 @@ namespace MediaBrowser.Controller
|
|||
string UserConfigurationDirectoryPath { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the internal metadata path.
|
||||
/// Gets the default internal metadata path.
|
||||
/// </summary>
|
||||
string DefaultInternalMetadataPath { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the internal metadata path, either a custom path or the default.
|
||||
/// </summary>
|
||||
/// <value>The internal metadata path.</value>
|
||||
string InternalMetadataPath { get; }
|
||||
|
|
Loading…
Reference in New Issue
Block a user