aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs
diff options
context:
space:
mode:
authorBond-009 <bond.009@outlook.com>2019-01-30 16:57:15 +0100
committerGitHub <noreply@github.com>2019-01-30 16:57:15 +0100
commit1ea219bf3f5c0708c3afa5fa2d897ca5212b5e04 (patch)
treeb3478e7210659ef7fa1e305e814c188ffd152fea /Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs
parenta709cbdc64de36a1ce989636a19344af61d9026d (diff)
parentffcf6bdd3aaad5068decf84b0400e433fdb8323c (diff)
Merge branch 'master' into culture
Diffstat (limited to 'Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs')
-rw-r--r--Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs18
1 files changed, 9 insertions, 9 deletions
diff --git a/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs b/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs
index ff35b3205..460809e93 100644
--- a/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs
+++ b/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs
@@ -127,7 +127,7 @@ namespace Emby.Server.Implementations.AppBase
Logger.LogInformation("Saving system configuration");
var path = CommonApplicationPaths.SystemConfigurationFilePath;
- FileSystem.CreateDirectory(FileSystem.GetDirectoryName(path));
+ Directory.CreateDirectory(Path.GetDirectoryName(path));
lock (_configurationSyncLock)
{
@@ -197,7 +197,7 @@ namespace Emby.Server.Implementations.AppBase
&& !string.Equals(CommonConfiguration.CachePath ?? string.Empty, newPath))
{
// Validate
- if (!FileSystem.DirectoryExists(newPath))
+ if (!Directory.Exists(newPath))
{
throw new FileNotFoundException(string.Format("{0} does not exist.", newPath));
}
@@ -209,8 +209,7 @@ namespace Emby.Server.Implementations.AppBase
protected void EnsureWriteAccess(string path)
{
var file = Path.Combine(path, Guid.NewGuid().ToString());
-
- FileSystem.WriteAllText(file, string.Empty);
+ File.WriteAllText(file, string.Empty);
FileSystem.DeleteFile(file);
}
@@ -246,13 +245,14 @@ namespace Emby.Server.Implementations.AppBase
private object LoadConfiguration(string path, Type configurationType)
{
- try
+ if (!File.Exists(path))
{
- return XmlSerializer.DeserializeFromFile(configurationType, path);
+ return Activator.CreateInstance(configurationType);
}
- catch (FileNotFoundException)
+
+ try
{
- return Activator.CreateInstance(configurationType);
+ return XmlSerializer.DeserializeFromFile(configurationType, path);
}
catch (IOException)
{
@@ -293,7 +293,7 @@ namespace Emby.Server.Implementations.AppBase
_configurations.AddOrUpdate(key, configuration, (k, v) => configuration);
var path = GetConfigurationFile(key);
- FileSystem.CreateDirectory(FileSystem.GetDirectoryName(path));
+ Directory.CreateDirectory(Path.GetDirectoryName(path));
lock (_configurationSyncLock)
{