diff options
Diffstat (limited to 'MediaBrowser.Common.Implementations/BaseApplicationPaths.cs')
| -rw-r--r-- | MediaBrowser.Common.Implementations/BaseApplicationPaths.cs | 90 |
1 files changed, 13 insertions, 77 deletions
diff --git a/MediaBrowser.Common.Implementations/BaseApplicationPaths.cs b/MediaBrowser.Common.Implementations/BaseApplicationPaths.cs index 6acaac5c9..668b1395d 100644 --- a/MediaBrowser.Common.Implementations/BaseApplicationPaths.cs +++ b/MediaBrowser.Common.Implementations/BaseApplicationPaths.cs @@ -2,7 +2,6 @@ using System; using System.Configuration; using System.IO; -using System.Reflection; namespace MediaBrowser.Common.Implementations { @@ -82,10 +81,6 @@ namespace MediaBrowser.Common.Implementations } /// <summary> - /// The _image cache path - /// </summary> - private string _imageCachePath; - /// <summary> /// Gets the image cache path. /// </summary> /// <value>The image cache path.</value> @@ -93,22 +88,11 @@ namespace MediaBrowser.Common.Implementations { get { - if (_imageCachePath == null) - { - _imageCachePath = Path.Combine(CachePath, "images"); - - Directory.CreateDirectory(_imageCachePath); - } - - return _imageCachePath; + return Path.Combine(CachePath, "images"); } } /// <summary> - /// The _plugins path - /// </summary> - private string _pluginsPath; - /// <summary> /// Gets the path to the plugin directory /// </summary> /// <value>The plugins path.</value> @@ -116,21 +100,11 @@ namespace MediaBrowser.Common.Implementations { get { - if (_pluginsPath == null) - { - _pluginsPath = Path.Combine(ProgramDataPath, "plugins"); - Directory.CreateDirectory(_pluginsPath); - } - - return _pluginsPath; + return Path.Combine(ProgramDataPath, "plugins"); } } /// <summary> - /// The _plugin configurations path - /// </summary> - private string _pluginConfigurationsPath; - /// <summary> /// Gets the path to the plugin configurations directory /// </summary> /// <value>The plugin configurations path.</value> @@ -138,17 +112,10 @@ namespace MediaBrowser.Common.Implementations { get { - if (_pluginConfigurationsPath == null) - { - _pluginConfigurationsPath = Path.Combine(PluginsPath, "configurations"); - Directory.CreateDirectory(_pluginConfigurationsPath); - } - - return _pluginConfigurationsPath; + return Path.Combine(PluginsPath, "configurations"); } } - private string _tempUpdatePath; /// <summary> /// Gets the path to where temporary update files will be stored /// </summary> @@ -157,21 +124,11 @@ namespace MediaBrowser.Common.Implementations { get { - if (_tempUpdatePath == null) - { - _tempUpdatePath = Path.Combine(ProgramDataPath, "updates"); - Directory.CreateDirectory(_tempUpdatePath); - } - - return _tempUpdatePath; + return Path.Combine(ProgramDataPath, "updates"); } } /// <summary> - /// The _log directory path - /// </summary> - private string _logDirectoryPath; - /// <summary> /// Gets the path to the log directory /// </summary> /// <value>The log directory path.</value> @@ -179,20 +136,11 @@ namespace MediaBrowser.Common.Implementations { get { - if (_logDirectoryPath == null) - { - _logDirectoryPath = Path.Combine(ProgramDataPath, "logs"); - Directory.CreateDirectory(_logDirectoryPath); - } - return _logDirectoryPath; + return Path.Combine(ProgramDataPath, "logs"); } } /// <summary> - /// The _configuration directory path - /// </summary> - private string _configurationDirectoryPath; - /// <summary> /// Gets the path to the application configuration root directory /// </summary> /// <value>The configuration directory path.</value> @@ -200,12 +148,7 @@ namespace MediaBrowser.Common.Implementations { get { - if (_configurationDirectoryPath == null) - { - _configurationDirectoryPath = Path.Combine(ProgramDataPath, "config"); - Directory.CreateDirectory(_configurationDirectoryPath); - } - return _configurationDirectoryPath; + return Path.Combine(ProgramDataPath, "config"); } } @@ -233,7 +176,7 @@ namespace MediaBrowser.Common.Implementations { get { - if (_cachePath == null) + if (string.IsNullOrEmpty(_cachePath)) { _cachePath = Path.Combine(ProgramDataPath, "cache"); @@ -242,13 +185,13 @@ namespace MediaBrowser.Common.Implementations return _cachePath; } + set + { + _cachePath = value; + } } /// <summary> - /// The _temp directory - /// </summary> - private string _tempDirectory; - /// <summary> /// Gets the folder path to the temp directory within the cache folder /// </summary> /// <value>The temp directory.</value> @@ -256,14 +199,7 @@ namespace MediaBrowser.Common.Implementations { get { - if (_tempDirectory == null) - { - _tempDirectory = Path.Combine(CachePath, "temp"); - - Directory.CreateDirectory(_tempDirectory); - } - - return _tempDirectory; + return Path.Combine(CachePath, "temp"); } } @@ -273,7 +209,7 @@ namespace MediaBrowser.Common.Implementations /// <returns>System.String.</returns> private string GetProgramDataPath() { - var programDataPath = _useDebugPath ? ConfigurationManager.AppSettings["DebugProgramDataPath"] : Path.Combine(ConfigurationManager.AppSettings["ReleaseProgramDataPath"], ConfigurationManager.AppSettings["ProgramDataFolderName"]); + var programDataPath = _useDebugPath ? ConfigurationManager.AppSettings["DebugProgramDataPath"] : ConfigurationManager.AppSettings["ReleaseProgramDataPath"]; programDataPath = programDataPath.Replace("%ApplicationData%", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)); |
