Merge branch 'netcore/feature/abstract-systemdirectories' into netcore/feature/AB3594_move_exsiting_configuration_to_own_project

# Conflicts:
#	src/Umbraco.Abstractions/IO/IIOHelper.cs
#	src/Umbraco.Core/IO/IOHelper.cs
This commit is contained in:
Bjarke Berg
2019-11-13 13:26:44 +01:00
4 changed files with 77 additions and 25 deletions

View File

@@ -3,16 +3,22 @@ using System.Collections.Generic;
using System.Globalization;
using System.Reflection;
using System.IO;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Hosting;
using Umbraco.Core.Configuration;
namespace Umbraco.Core.IO
{
public class IOHelper : IIOHelper
{
internal static IIOHelper Default { get; } = new IOHelper();
private readonly IGlobalSettings _globalSettings;
internal static IIOHelper Default { get; } = new IOHelper(new GlobalSettings());
public IOHelper(IGlobalSettings globalSettings)
{
_globalSettings = globalSettings;
}
/// <summary>
/// Gets or sets a value forcing Umbraco to consider it is non-hosted.
@@ -114,23 +120,6 @@ namespace Umbraco.Core.IO
return MapPath(path, true);
}
//use a tilde character instead of the complete path
private string ReturnPath(string settingsKey, string standardPath, bool useTilde)
{
var retval = ConfigurationManager.AppSettings[settingsKey];
if (string.IsNullOrEmpty(retval))
retval = standardPath;
return retval.TrimEnd('/');
}
private string ReturnPath(string settingsKey, string standardPath)
{
return ReturnPath(settingsKey, standardPath, false);
}
/// <summary>
/// Verifies that the current filepath matches a directory where the user is allowed to edit a file.
/// </summary>
@@ -304,13 +293,13 @@ namespace Umbraco.Core.IO
}
public string Media => ReturnPath("umbracoMediaPath", "~/media");
public string Media => _globalSettings.UmbracoMediaPath;
public string Scripts => ReturnPath("umbracoScriptsPath", "~/scripts");
public string Scripts => _globalSettings.UmbracoScriptsPath;
public string Css => ReturnPath("umbracoCssPath", "~/css");
public string Css => _globalSettings.UmbracoCssPath;
public string Umbraco => ReturnPath("umbracoPath", "~/umbraco");
public string Umbraco => _globalSettings.UmbracoPath;
private string _root;