diff options
Diffstat (limited to 'MediaBrowser.Common.Implementations/BaseApplicationPaths.cs')
| -rw-r--r-- | MediaBrowser.Common.Implementations/BaseApplicationPaths.cs | 65 |
1 files changed, 2 insertions, 63 deletions
diff --git a/MediaBrowser.Common.Implementations/BaseApplicationPaths.cs b/MediaBrowser.Common.Implementations/BaseApplicationPaths.cs index 668b1395d..4ad63b2e3 100644 --- a/MediaBrowser.Common.Implementations/BaseApplicationPaths.cs +++ b/MediaBrowser.Common.Implementations/BaseApplicationPaths.cs @@ -1,6 +1,4 @@ using MediaBrowser.Common.Configuration; -using System; -using System.Configuration; using System.IO; namespace MediaBrowser.Common.Implementations @@ -12,45 +10,16 @@ namespace MediaBrowser.Common.Implementations public abstract class BaseApplicationPaths : IApplicationPaths { /// <summary> - /// The _use debug path - /// </summary> - private readonly bool _useDebugPath; - - /// <summary> - /// Initializes a new instance of the <see cref="BaseApplicationPaths" /> class. - /// </summary> - protected BaseApplicationPaths(bool useDebugPath, string applicationPath) - { - _useDebugPath = useDebugPath; - ApplicationPath = applicationPath; - } - - /// <summary> /// Initializes a new instance of the <see cref="BaseApplicationPaths"/> class. /// </summary> protected BaseApplicationPaths(string programDataPath, string applicationPath) { - _programDataPath = programDataPath; + ProgramDataPath = programDataPath; ApplicationPath = applicationPath; } public string ApplicationPath { get; private set; } - - /// <summary> - /// The _program data path - /// </summary> - private string _programDataPath; - /// <summary> - /// Gets the path to the program data folder - /// </summary> - /// <value>The program data path.</value> - public string ProgramDataPath - { - get - { - return _programDataPath ?? (_programDataPath = GetProgramDataPath()); - } - } + public string ProgramDataPath { get; private set; } /// <summary> /// Gets the path to the system folder @@ -202,35 +171,5 @@ namespace MediaBrowser.Common.Implementations return Path.Combine(CachePath, "temp"); } } - - /// <summary> - /// Gets the path to the application's ProgramDataFolder - /// </summary> - /// <returns>System.String.</returns> - private string GetProgramDataPath() - { - var programDataPath = _useDebugPath ? ConfigurationManager.AppSettings["DebugProgramDataPath"] : ConfigurationManager.AppSettings["ReleaseProgramDataPath"]; - - programDataPath = programDataPath.Replace("%ApplicationData%", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)); - - // If it's a relative path, e.g. "..\" - if (!Path.IsPathRooted(programDataPath)) - { - var path = Path.GetDirectoryName(ApplicationPath); - - if (string.IsNullOrEmpty(path)) - { - throw new ApplicationException("Unable to determine running assembly location"); - } - - programDataPath = Path.Combine(path, programDataPath); - - programDataPath = Path.GetFullPath(programDataPath); - } - - Directory.CreateDirectory(programDataPath); - - return programDataPath; - } } } |
