mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-16 10:03:51 -07:00
PathProvider. visit us for all of your pathing needs.
This commit is contained in:
parent
c503b497ed
commit
633f0b6197
24 changed files with 315 additions and 188 deletions
111
NzbDrone.Common/PathProvider.cs
Normal file
111
NzbDrone.Common/PathProvider.cs
Normal file
|
@ -0,0 +1,111 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
|
||||
namespace NzbDrone.Common
|
||||
{
|
||||
public class PathProvider
|
||||
{
|
||||
|
||||
private const string WEB_FOLDER = "NzbDrone.Web";
|
||||
private const string APP_DATA = "App_Data";
|
||||
|
||||
private const string LOG_CONFIG_FILE = "log.config";
|
||||
private const string APP_CONFIG_FILE = "config.xml";
|
||||
|
||||
private const string NZBDRONE_DB_FILE = "nzbdrone.sdf";
|
||||
private const string LOG_DB_FILE = "log.sdf";
|
||||
|
||||
public const string UPDATE_SANDBOX_FOLDER_NAME = "nzbdrone_update";
|
||||
|
||||
private readonly string _applicationPath;
|
||||
|
||||
|
||||
public PathProvider(EnviromentProvider enviromentProvider)
|
||||
{
|
||||
_applicationPath = enviromentProvider.ApplicationPath;
|
||||
}
|
||||
|
||||
public PathProvider()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual String LogPath
|
||||
{
|
||||
get { return Environment.CurrentDirectory; }
|
||||
}
|
||||
|
||||
public virtual string WebRoot
|
||||
{
|
||||
get
|
||||
{
|
||||
return Path.Combine(_applicationPath, WEB_FOLDER);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual string AppData
|
||||
{
|
||||
get
|
||||
{
|
||||
var path = Path.Combine(WebRoot, APP_DATA);
|
||||
if (!Directory.Exists(path))
|
||||
Directory.CreateDirectory(path);
|
||||
|
||||
return path;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual string NzbDronoeDbFile
|
||||
{
|
||||
get
|
||||
{
|
||||
|
||||
return Path.Combine(AppData, NZBDRONE_DB_FILE);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual string LogDbFile
|
||||
{
|
||||
get
|
||||
{
|
||||
|
||||
return Path.Combine(AppData, LOG_DB_FILE);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual String SystemTemp
|
||||
{
|
||||
get
|
||||
{
|
||||
return Path.GetTempPath();
|
||||
}
|
||||
}
|
||||
|
||||
public string LogConfigFile
|
||||
{
|
||||
get { return Path.Combine(WebRoot, LOG_CONFIG_FILE); }
|
||||
}
|
||||
|
||||
public string AppConfigFile
|
||||
{
|
||||
get { return Path.Combine(_applicationPath, APP_CONFIG_FILE); }
|
||||
}
|
||||
|
||||
public string BannerPath
|
||||
{
|
||||
get { return Path.Combine(WebRoot, "Content", "Images", "Banners"); }
|
||||
}
|
||||
|
||||
public string CacheFolder
|
||||
{
|
||||
get { return Path.Combine(AppData, "Cache"); }
|
||||
}
|
||||
|
||||
public string UpdateSandboxFolder
|
||||
{
|
||||
get { return Path.Combine(SystemTemp, UPDATE_SANDBOX_FOLDER_NAME); }
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue