using System;
using System.IO;
using MediaBrowser.Common.Configuration;
namespace Emby.Server.Implementations.AppBase
{
///
/// Provides a base class to hold common application paths used by both the UI and Server.
/// This can be subclassed to add application-specific paths.
///
public abstract class BaseApplicationPaths : IApplicationPaths
{
///
/// Initializes a new instance of the class.
///
/// The program data path.
/// The log directory path.
/// The configuration directory path.
/// The cache directory path.
/// The web directory path.
protected BaseApplicationPaths(
string programDataPath,
string logDirectoryPath,
string configurationDirectoryPath,
string cacheDirectoryPath,
string webDirectoryPath)
{
ProgramDataPath = programDataPath;
LogDirectoryPath = logDirectoryPath;
ConfigurationDirectoryPath = configurationDirectoryPath;
CachePath = cacheDirectoryPath;
WebPath = webDirectoryPath;
DataPath = Directory.CreateDirectory(Path.Combine(ProgramDataPath, "data")).FullName;
}
///
public string ProgramDataPath { get; }
///
public string WebPath { get; }
///
public string ProgramSystemPath { get; } = AppContext.BaseDirectory;
///
public string DataPath { get; }
///
public string VirtualDataPath => "%AppDataPath%";
///
public string ImageCachePath => Path.Combine(CachePath, "images");
///
public string PluginsPath => Path.Combine(ProgramDataPath, "plugins");
///
public string PluginConfigurationsPath => Path.Combine(PluginsPath, "configurations");
///
public string LogDirectoryPath { get; }
///
public string ConfigurationDirectoryPath { get; }
///
public string SystemConfigurationFilePath => Path.Combine(ConfigurationDirectoryPath, "system.xml");
///
public string CachePath { get; set; }
///
public string TempDirectory => Path.Join(Path.GetTempPath(), "jellyfin");
///
public string TrickplayPath => Path.Combine(DataPath, "trickplay");
}
}