diff options
| author | Joshua M. Boniface <joshua@boniface.me> | 2019-02-09 19:37:56 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-02-09 19:37:56 -0500 |
| commit | 1b8444683135d306cc92922d6da27993ec7fd064 (patch) | |
| tree | 798ba6b25538059501cc1b32252eaaecff6ccf4b /Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs | |
| parent | 4727f69fc9421b163bd162372b2b14257b6dacf8 (diff) | |
| parent | 382b8bb509bbce34354a5d667c755b91d52c4fa4 (diff) | |
Merge pull request #853 from joshuaboniface/fix-cache-reset
Fix poor handling of cache directories
Diffstat (limited to 'Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs')
| -rw-r--r-- | Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs b/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs index 460809e93..5feac1adf 100644 --- a/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs +++ b/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs @@ -171,16 +171,29 @@ namespace Emby.Server.Implementations.AppBase private void UpdateCachePath() { string cachePath; - + // If the configuration file has no entry (i.e. not set in UI) if (string.IsNullOrWhiteSpace(CommonConfiguration.CachePath)) { - cachePath = null; + // If the current live configuration has no entry (i.e. not set on CLI/envvars, during startup) + if (string.IsNullOrWhiteSpace(((BaseApplicationPaths)CommonApplicationPaths).CachePath)) + { + // Set cachePath to a default value under ProgramDataPath + cachePath = Path.Combine(((BaseApplicationPaths)CommonApplicationPaths).ProgramDataPath, "cache"); + } + else + { + // Set cachePath to the existing live value; will require restart if UI value is removed (but not replaced) + // TODO: Figure out how to re-grab this from the CLI/envvars while running + cachePath = ((BaseApplicationPaths)CommonApplicationPaths).CachePath; + } } else { - cachePath = Path.Combine(CommonConfiguration.CachePath, "cache"); + // Set cachePath to the new UI-set value + cachePath = CommonConfiguration.CachePath; } + Logger.LogInformation("Setting cache path to " + cachePath); ((BaseApplicationPaths)CommonApplicationPaths).CachePath = cachePath; } |
