Changed SystemDirectories from static to instance, Added interface in abstractions and create a static property on current.

This commit is contained in:
Bjarke Berg
2019-11-12 15:25:21 +01:00
parent 282220ee39
commit 0fcf8325e3
68 changed files with 249 additions and 191 deletions

View File

@@ -171,7 +171,7 @@ namespace Umbraco.Core.Configuration
/// <param name="value">Value of the setting to be saved.</param>
internal static void SaveSetting(string key, string value)
{
var fileName = Current.IOHelper.MapPath(string.Format("{0}/web.config", SystemDirectories.Root));
var fileName = Current.IOHelper.MapPath(string.Format("{0}/web.config", Current.SystemDirectories.Root));
var xml = XDocument.Load(fileName, LoadOptions.PreserveWhitespace);
var appSettings = xml.Root.DescendantsAndSelf("appSettings").Single();
@@ -193,7 +193,7 @@ namespace Umbraco.Core.Configuration
/// <param name="key">Key of the setting to be removed.</param>
internal static void RemoveSetting(string key)
{
var fileName = Current.IOHelper.MapPath(string.Format("{0}/web.config", SystemDirectories.Root));
var fileName = Current.IOHelper.MapPath(string.Format("{0}/web.config", Current.SystemDirectories.Root));
var xml = XDocument.Load(fileName, LoadOptions.PreserveWhitespace);
var appSettings = xml.Root.DescendantsAndSelf("appSettings").Single();

View File

@@ -5,6 +5,7 @@ using System.Linq;
using System.Threading;
using System.Web;
using System.Web.Routing;
using Umbraco.Core.Composing;
using Umbraco.Core.IO;
namespace Umbraco.Core.Configuration
@@ -42,8 +43,8 @@ namespace Umbraco.Core.Configuration
}
var path = globalSettings.Path;
if (path.StartsWith(SystemDirectories.Root)) // beware of TrimStart, see U4-2518
path = path.Substring(SystemDirectories.Root.Length);
if (path.StartsWith(Current.SystemDirectories.Root)) // beware of TrimStart, see U4-2518
path = path.Substring(Current.SystemDirectories.Root.Length);
return path.TrimStart('~').TrimStart('/').Replace('/', '-').Trim().ToLower();
}