Avoid usage of IOHelper in GlobalSettings

This commit is contained in:
Bjarke Berg
2020-03-13 10:00:03 +01:00
parent 6fafe0408d
commit ea15fdb14e
31 changed files with 99 additions and 82 deletions

View File

@@ -52,15 +52,13 @@ namespace Umbraco.Core
public static ICoreDebug CoreDebug(this Configs configs)
=> configs.GetConfig<ICoreDebug>();
public static void AddCoreConfigs(this Configs configs, IIOHelper ioHelper)
public static void AddCoreConfigs(this Configs configs)
{
var configDir = new DirectoryInfo(ioHelper.MapPath(Constants.SystemDirectories.Config));
// GridConfig depends on runtime caches, manifest parsers... and cannot be available during composition
configs.Add<IGridConfig>(factory => new GridConfig(
factory.GetInstance<ILogger>(),
factory.GetInstance<AppCaches>(),
configDir,
new DirectoryInfo(factory.GetInstance<IIOHelper>().MapPath(Constants.SystemDirectories.Config)),
factory.GetInstance<IManifestParser>(),
factory.GetInstance<IRuntimeState>().Debug));
}

View File

@@ -28,14 +28,15 @@ namespace Umbraco.Core.Configuration
return _mvcArea;
}
//TODO Move to IOHelper
internal static string GetUmbracoMvcAreaNoCache(this IGlobalSettings globalSettings, IIOHelper ioHelper)
{
if (globalSettings.Path.IsNullOrWhiteSpace())
if (ioHelper.BackOfficePath.IsNullOrWhiteSpace())
{
throw new InvalidOperationException("Cannot create an MVC Area path without the umbracoPath specified");
}
var path = globalSettings.Path;
var path = ioHelper.BackOfficePath;
if (path.StartsWith(ioHelper.Root)) // beware of TrimStart, see U4-2518
path = path.Substring(ioHelper.Root.Length);
return path.TrimStart('~').TrimStart('/').Replace('/', '-').Trim().ToLower();

View File

@@ -21,7 +21,7 @@
string ReservedPaths { get; }
/// <summary>
/// Gets the path to umbraco's root directory (/umbraco by default).
/// Gets the path to umbraco's root directory.
/// </summary>
string Path { get; }