diff --git a/src/Umbraco.Abstractions/IO/ISystemDirectories.cs b/src/Umbraco.Abstractions/IO/ISystemDirectories.cs new file mode 100644 index 0000000000..4c1499760e --- /dev/null +++ b/src/Umbraco.Abstractions/IO/ISystemDirectories.cs @@ -0,0 +1,33 @@ +namespace Umbraco.Core.IO +{ + public interface ISystemDirectories + { + string Bin { get; } + string Config { get; } + string Data { get; } + string TempData { get; } + string TempFileUploads { get; } + string TempImageUploads { get; } + string Install { get; } + string AppCode { get; } + string AppPlugins { get; } + string MvcViews { get; } + string PartialViews { get; } + string MacroPartials { get; } + string Media { get; } + string Scripts { get; } + string Css { get; } + string Umbraco { get; } + string Packages { get; } + string Preview { get; } + + /// + /// Gets the root path of the application + /// + string Root + { + get; + set; //Only required for unit tests + } + } +} diff --git a/src/Umbraco.Core/Composing/CompositionExtensions/FileSystems.cs b/src/Umbraco.Core/Composing/CompositionExtensions/FileSystems.cs index 8518d907b5..27a8a03323 100644 --- a/src/Umbraco.Core/Composing/CompositionExtensions/FileSystems.cs +++ b/src/Umbraco.Core/Composing/CompositionExtensions/FileSystems.cs @@ -90,7 +90,7 @@ namespace Umbraco.Core.Composing.CompositionExtensions // register the IFileSystem supporting the IMediaFileSystem // THIS IS THE ONLY THING THAT NEEDS TO CHANGE, IN ORDER TO REPLACE THE UNDERLYING FILESYSTEM // and, SupportingFileSystem.For() returns the underlying filesystem - composition.SetMediaFileSystem(() => new PhysicalFileSystem(SystemDirectories.Media)); + composition.SetMediaFileSystem(() => new PhysicalFileSystem(Current.SystemDirectories.Media)); return composition; } diff --git a/src/Umbraco.Core/Composing/CompositionExtensions/Services.cs b/src/Umbraco.Core/Composing/CompositionExtensions/Services.cs index 9d7d0a191d..bec5640860 100644 --- a/src/Umbraco.Core/Composing/CompositionExtensions/Services.cs +++ b/src/Umbraco.Core/Composing/CompositionExtensions/Services.cs @@ -89,9 +89,10 @@ namespace Umbraco.Core.Composing.CompositionExtensions private static LocalizedTextServiceFileSources SourcesFactory(IFactory container) { - var mainLangFolder = new DirectoryInfo(Current.IOHelper.MapPath(SystemDirectories.Umbraco + "/config/lang/")); - var appPlugins = new DirectoryInfo(Current.IOHelper.MapPath(SystemDirectories.AppPlugins)); - var configLangFolder = new DirectoryInfo(Current.IOHelper.MapPath(SystemDirectories.Config + "/lang/")); + ISystemDirectories systemDirectories = new SystemDirectories(); + var mainLangFolder = new DirectoryInfo(Current.IOHelper.MapPath(systemDirectories.Umbraco + "/config/lang/")); + var appPlugins = new DirectoryInfo(Current.IOHelper.MapPath(systemDirectories.AppPlugins)); + var configLangFolder = new DirectoryInfo(Current.IOHelper.MapPath(systemDirectories.Config + "/lang/")); var pluginLangFolders = appPlugins.Exists == false ? Enumerable.Empty() diff --git a/src/Umbraco.Core/Composing/Current.cs b/src/Umbraco.Core/Composing/Current.cs index d018ec7bcb..e617e70a1a 100644 --- a/src/Umbraco.Core/Composing/Current.cs +++ b/src/Umbraco.Core/Composing/Current.cs @@ -205,7 +205,8 @@ namespace Umbraco.Core.Composing public static IVariationContextAccessor VariationContextAccessor => Factory.GetInstance(); - public static readonly IIOHelper IOHelper = new IOHelper(); + public static readonly IIOHelper IOHelper = Umbraco.Core.IO.IOHelper.Default; + public static readonly ISystemDirectories SystemDirectories = new SystemDirectories(); #endregion } diff --git a/src/Umbraco.Core/Configuration/GlobalSettings.cs b/src/Umbraco.Core/Configuration/GlobalSettings.cs index f2438065a4..0e024346af 100644 --- a/src/Umbraco.Core/Configuration/GlobalSettings.cs +++ b/src/Umbraco.Core/Configuration/GlobalSettings.cs @@ -171,7 +171,7 @@ namespace Umbraco.Core.Configuration /// Value of the setting to be saved. 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 /// Key of the setting to be removed. 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(); diff --git a/src/Umbraco.Core/Configuration/GlobalSettingsExtensions.cs b/src/Umbraco.Core/Configuration/GlobalSettingsExtensions.cs index bc76caacee..2bc1e8d8c2 100644 --- a/src/Umbraco.Core/Configuration/GlobalSettingsExtensions.cs +++ b/src/Umbraco.Core/Configuration/GlobalSettingsExtensions.cs @@ -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(); } diff --git a/src/Umbraco.Core/IO/FileSystems.cs b/src/Umbraco.Core/IO/FileSystems.cs index 8906752dd1..88ed3b48ae 100644 --- a/src/Umbraco.Core/IO/FileSystems.cs +++ b/src/Umbraco.Core/IO/FileSystems.cs @@ -11,6 +11,7 @@ namespace Umbraco.Core.IO { private readonly IFactory _container; private readonly ILogger _logger; + private readonly ISystemDirectories _systemDirectories; private readonly ConcurrentDictionary> _filesystems = new ConcurrentDictionary>(); @@ -37,6 +38,7 @@ namespace Umbraco.Core.IO { _container = container; _logger = logger; + _systemDirectories = Current.SystemDirectories; } // for tests only, totally unsafe @@ -120,11 +122,11 @@ namespace Umbraco.Core.IO // but it does not really matter what we return - here, null private object CreateWellKnownFileSystems() { - var macroPartialFileSystem = new PhysicalFileSystem(SystemDirectories.MacroPartials); - var partialViewsFileSystem = new PhysicalFileSystem(SystemDirectories.PartialViews); - var stylesheetsFileSystem = new PhysicalFileSystem(SystemDirectories.Css); - var scriptsFileSystem = new PhysicalFileSystem(SystemDirectories.Scripts); - var mvcViewsFileSystem = new PhysicalFileSystem(SystemDirectories.MvcViews); + var macroPartialFileSystem = new PhysicalFileSystem(_systemDirectories.MacroPartials); + var partialViewsFileSystem = new PhysicalFileSystem(_systemDirectories.PartialViews); + var stylesheetsFileSystem = new PhysicalFileSystem(_systemDirectories.Css); + var scriptsFileSystem = new PhysicalFileSystem(_systemDirectories.Scripts); + var mvcViewsFileSystem = new PhysicalFileSystem(_systemDirectories.MvcViews); _macroPartialFileSystem = new ShadowWrapper(macroPartialFileSystem, "macro-partials", IsScoped); _partialViewsFileSystem = new ShadowWrapper(partialViewsFileSystem, "partials", IsScoped); diff --git a/src/Umbraco.Core/IO/IOHelper.cs b/src/Umbraco.Core/IO/IOHelper.cs index 36215b267c..3925e6d8d5 100644 --- a/src/Umbraco.Core/IO/IOHelper.cs +++ b/src/Umbraco.Core/IO/IOHelper.cs @@ -13,7 +13,13 @@ namespace Umbraco.Core.IO { public class IOHelper : IIOHelper { - internal static IIOHelper Default { get; } = new IOHelper(); + private readonly ISystemDirectories _systemDirectories; + internal static IIOHelper Default { get; } = new IOHelper(new SystemDirectories()); + + public IOHelper(ISystemDirectories systemDirectories) + { + _systemDirectories = systemDirectories; + } /// /// Gets or sets a value forcing Umbraco to consider it is non-hosted. @@ -39,10 +45,10 @@ namespace Umbraco.Core.IO string retval = virtualPath; if (virtualPath.StartsWith("~")) - retval = virtualPath.Replace("~", SystemDirectories.Root); + retval = virtualPath.Replace("~", _systemDirectories.Root); - if (virtualPath.StartsWith("/") && virtualPath.StartsWith(SystemDirectories.Root) == false) - retval = SystemDirectories.Root + "/" + virtualPath.TrimStart('/'); + if (virtualPath.StartsWith("/") && virtualPath.StartsWith(_systemDirectories.Root) == false) + retval = _systemDirectories.Root + "/" + virtualPath.TrimStart('/'); return retval; } @@ -57,11 +63,11 @@ namespace Umbraco.Core.IO public string ResolveUrl(string virtualPath) { if (virtualPath.StartsWith("~")) - return virtualPath.Replace("~", SystemDirectories.Root).Replace("//", "/"); + return virtualPath.Replace("~", _systemDirectories.Root).Replace("//", "/"); else if (Uri.IsWellFormedUriString(virtualPath, UriKind.Absolute)) return virtualPath; else - return VirtualPathUtility.ToAbsolute(virtualPath, SystemDirectories.Root); + return VirtualPathUtility.ToAbsolute(virtualPath, _systemDirectories.Root); } public Attempt TryResolveUrl(string virtualPath) @@ -69,10 +75,10 @@ namespace Umbraco.Core.IO try { if (virtualPath.StartsWith("~")) - return Attempt.Succeed(virtualPath.Replace("~", SystemDirectories.Root).Replace("//", "/")); + return Attempt.Succeed(virtualPath.Replace("~", _systemDirectories.Root).Replace("//", "/")); if (Uri.IsWellFormedUriString(virtualPath, UriKind.Absolute)) return Attempt.Succeed(virtualPath); - return Attempt.Succeed(VirtualPathUtility.ToAbsolute(virtualPath, SystemDirectories.Root)); + return Attempt.Succeed(VirtualPathUtility.ToAbsolute(virtualPath, _systemDirectories.Root)); } catch (Exception ex) { @@ -97,7 +103,7 @@ namespace Umbraco.Core.IO if (useHttpContext && HttpContext.Current != null) { //string retval; - if (String.IsNullOrEmpty(path) == false && (path.StartsWith("~") || path.StartsWith(SystemDirectories.Root))) + if (String.IsNullOrEmpty(path) == false && (path.StartsWith("~") || path.StartsWith(_systemDirectories.Root))) return HostingEnvironment.MapPath(path); else return HostingEnvironment.MapPath("~/" + path.TrimStart('/')); @@ -160,7 +166,7 @@ namespace Umbraco.Core.IO // TODO: what's below is dirty, there are too many ways to get the root dir, etc. // not going to fix everything today - var mappedRoot = MapPath(SystemDirectories.Root); + var mappedRoot = MapPath(_systemDirectories.Root); if (filePath.StartsWith(mappedRoot) == false) filePath = MapPath(filePath); diff --git a/src/Umbraco.Core/IO/ShadowWrapper.cs b/src/Umbraco.Core/IO/ShadowWrapper.cs index 44152d7c1a..aab65e0a25 100644 --- a/src/Umbraco.Core/IO/ShadowWrapper.cs +++ b/src/Umbraco.Core/IO/ShadowWrapper.cs @@ -8,7 +8,7 @@ namespace Umbraco.Core.IO { internal class ShadowWrapper : IFileSystem { - private static readonly string ShadowFsPath = SystemDirectories.TempData.EnsureEndsWith('/') + "ShadowFs"; + private static readonly string ShadowFsPath = Current.SystemDirectories.TempData.EnsureEndsWith('/') + "ShadowFs"; private readonly Func _isScoped; private readonly IFileSystem _innerFileSystem; diff --git a/src/Umbraco.Core/IO/SystemDirectories.cs b/src/Umbraco.Core/IO/SystemDirectories.cs index c5c410ff3f..4a976f5675 100644 --- a/src/Umbraco.Core/IO/SystemDirectories.cs +++ b/src/Umbraco.Core/IO/SystemDirectories.cs @@ -4,50 +4,50 @@ using Umbraco.Core.Composing; namespace Umbraco.Core.IO { //all paths has a starting but no trailing / - public class SystemDirectories + public class SystemDirectories : ISystemDirectories { - public static string Bin => "~/bin"; + public string Bin => "~/bin"; - public static string Config => "~/config"; + public string Config => "~/config"; - public static string Data => "~/App_Data"; + public string Data => "~/App_Data"; - public static string TempData => Data + "/TEMP"; + public string TempData => Data + "/TEMP"; - public static string TempFileUploads => TempData + "/FileUploads"; + public string TempFileUploads => TempData + "/FileUploads"; - public static string TempImageUploads => TempFileUploads + "/rte"; + public string TempImageUploads => TempFileUploads + "/rte"; - public static string Install => "~/install"; + public string Install => "~/install"; - public static string AppCode => "~/App_Code"; + public string AppCode => "~/App_Code"; - public static string AppPlugins => "~/App_Plugins"; + public string AppPlugins => "~/App_Plugins"; - public static string MvcViews => "~/Views"; + public string MvcViews => "~/Views"; - public static string PartialViews => MvcViews + "/Partials/"; + public string PartialViews => MvcViews + "/Partials/"; - public static string MacroPartials => MvcViews + "/MacroPartials/"; + public string MacroPartials => MvcViews + "/MacroPartials/"; - public static string Media => Current.IOHelper.ReturnPath("umbracoMediaPath", "~/media"); + public string Media => Current.IOHelper.ReturnPath("umbracoMediaPath", "~/media"); - public static string Scripts => Current.IOHelper.ReturnPath("umbracoScriptsPath", "~/scripts"); + public string Scripts => Current.IOHelper.ReturnPath("umbracoScriptsPath", "~/scripts"); - public static string Css => Current.IOHelper.ReturnPath("umbracoCssPath", "~/css"); + public string Css => Current.IOHelper.ReturnPath("umbracoCssPath", "~/css"); - public static string Umbraco => Current.IOHelper.ReturnPath("umbracoPath", "~/umbraco"); + public string Umbraco => Current.IOHelper.ReturnPath("umbracoPath", "~/umbraco"); - public static string Packages => Data + "/packages"; + public string Packages => Data + "/packages"; - public static string Preview => Data + "/preview"; + public string Preview => Data + "/preview"; - private static string _root; + private string _root; /// /// Gets the root path of the application /// - public static string Root + public string Root { get { @@ -62,7 +62,7 @@ namespace Umbraco.Core.IO return _root; } //Only required for unit tests - internal set => _root = value; + set => _root = value; } } } diff --git a/src/Umbraco.Core/IO/SystemFiles.cs b/src/Umbraco.Core/IO/SystemFiles.cs index 12e3f57d99..7df39eac6c 100644 --- a/src/Umbraco.Core/IO/SystemFiles.cs +++ b/src/Umbraco.Core/IO/SystemFiles.cs @@ -1,11 +1,12 @@ using System.IO; +using Umbraco.Core.Composing; using Umbraco.Core.Configuration; namespace Umbraco.Core.IO { public class SystemFiles { - public static string TinyMceConfig => SystemDirectories.Config + "/tinyMceConfig.config"; + public static string TinyMceConfig => Current.SystemDirectories.Config + "/tinyMceConfig.config"; // TODO: Kill this off we don't have umbraco.config XML cache we now have NuCache public static string GetContentCacheXml(IGlobalSettings globalSettings) diff --git a/src/Umbraco.Core/Migrations/Install/DatabaseBuilder.cs b/src/Umbraco.Core/Migrations/Install/DatabaseBuilder.cs index a0c87ce510..a7c6b38c1c 100644 --- a/src/Umbraco.Core/Migrations/Install/DatabaseBuilder.cs +++ b/src/Umbraco.Core/Migrations/Install/DatabaseBuilder.cs @@ -283,7 +283,7 @@ namespace Umbraco.Core.Migrations.Install if (string.IsNullOrWhiteSpace(providerName)) throw new ArgumentNullOrEmptyException(nameof(providerName)); var fileSource = "web.config"; - var fileName = Current.IOHelper.MapPath(SystemDirectories.Root +"/" + fileSource); + var fileName = Current.IOHelper.MapPath(Current.SystemDirectories.Root +"/" + fileSource); var xml = XDocument.Load(fileName, LoadOptions.PreserveWhitespace); if (xml.Root == null) throw new Exception($"Invalid {fileSource} file (no root)."); @@ -296,7 +296,7 @@ namespace Umbraco.Core.Migrations.Install if (configSourceAttribute != null) { fileSource = configSourceAttribute.Value; - fileName = Current.IOHelper.MapPath(SystemDirectories.Root + "/" + fileSource); + fileName = Current.IOHelper.MapPath(Current.SystemDirectories.Root + "/" + fileSource); if (!File.Exists(fileName)) throw new Exception($"Invalid configSource \"{fileSource}\" (no such file)."); diff --git a/src/Umbraco.Core/Packaging/CompiledPackageXmlParser.cs b/src/Umbraco.Core/Packaging/CompiledPackageXmlParser.cs index 83034a7e1b..80857ab5eb 100644 --- a/src/Umbraco.Core/Packaging/CompiledPackageXmlParser.cs +++ b/src/Umbraco.Core/Packaging/CompiledPackageXmlParser.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Xml.Linq; +using Umbraco.Core.Composing; using Umbraco.Core.IO; using Umbraco.Core.Models; using Umbraco.Core.Models.Packaging; @@ -131,15 +132,15 @@ namespace Umbraco.Core.Packaging { return pathElement.TrimStart(new[] { '\\', '/', '~' }).Replace("/", "\\"); } - + private static string UpdatePathPlaceholders(string path) { if (path.Contains("[$")) { //this is experimental and undocumented... - path = path.Replace("[$UMBRACO]", SystemDirectories.Umbraco); - path = path.Replace("[$CONFIG]", SystemDirectories.Config); - path = path.Replace("[$DATA]", SystemDirectories.Data); + path = path.Replace("[$UMBRACO]", Current.SystemDirectories.Umbraco); + path = path.Replace("[$CONFIG]", Current.SystemDirectories.Config); + path = path.Replace("[$DATA]", Current.SystemDirectories.Data); } return path; } diff --git a/src/Umbraco.Core/Packaging/PackageDataInstallation.cs b/src/Umbraco.Core/Packaging/PackageDataInstallation.cs index 281cc2c396..8cd0225327 100644 --- a/src/Umbraco.Core/Packaging/PackageDataInstallation.cs +++ b/src/Umbraco.Core/Packaging/PackageDataInstallation.cs @@ -6,6 +6,7 @@ using System.Web; using System.Xml.Linq; using System.Xml.XPath; using Umbraco.Core.Collections; +using Umbraco.Core.Composing; using Umbraco.Core.IO; using Umbraco.Core.Logging; using Umbraco.Core.Models; @@ -1317,7 +1318,7 @@ namespace Umbraco.Core.Packaging private string ViewPath(string alias) { - return SystemDirectories.MvcViews + "/" + alias.Replace(" ", "") + ".cshtml"; + return Current.SystemDirectories.MvcViews + "/" + alias.Replace(" ", "") + ".cshtml"; } #endregion diff --git a/src/Umbraco.Core/Packaging/PackagesRepository.cs b/src/Umbraco.Core/Packaging/PackagesRepository.cs index 458a239cc0..24455308c8 100644 --- a/src/Umbraco.Core/Packaging/PackagesRepository.cs +++ b/src/Umbraco.Core/Packaging/PackagesRepository.cs @@ -70,9 +70,9 @@ namespace Umbraco.Core.Packaging _logger = logger; _packageRepositoryFileName = packageRepositoryFileName; - _tempFolderPath = tempFolderPath ?? SystemDirectories.TempData.EnsureEndsWith('/') + "PackageFiles"; - _packagesFolderPath = packagesFolderPath ?? SystemDirectories.Packages; - _mediaFolderPath = mediaFolderPath ?? SystemDirectories.Media + "/created-packages"; + _tempFolderPath = tempFolderPath ?? Current.SystemDirectories.TempData.EnsureEndsWith('/') + "PackageFiles"; + _packagesFolderPath = packagesFolderPath ?? Current.SystemDirectories.Packages; + _mediaFolderPath = mediaFolderPath ?? Current.SystemDirectories.Media + "/created-packages"; _parser = new PackageDefinitionXmlParser(logger); } diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/PartialViewRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/PartialViewRepository.cs index d7d1be55c7..bee7260b53 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/PartialViewRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/PartialViewRepository.cs @@ -103,7 +103,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement } // validate path & extension - var validDir = SystemDirectories.MvcViews; + var validDir = Current.SystemDirectories.MvcViews; var isValidPath = Current.IOHelper.VerifyEditPath(fullPath, validDir); var isValidExtension = Current.IOHelper.VerifyFileExtension(fullPath, ValidExtensions); return isValidPath && isValidExtension; diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/ScriptRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/ScriptRepository.cs index 491dafe577..3acdb331a1 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/ScriptRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/ScriptRepository.cs @@ -15,11 +15,13 @@ namespace Umbraco.Core.Persistence.Repositories.Implement internal class ScriptRepository : FileRepository, IScriptRepository { private readonly IIOHelper _ioHelper; + private readonly ISystemDirectories _systemDirectories; public ScriptRepository(IFileSystems fileSystems, IIOHelper ioHelper) : base(fileSystems.ScriptsFileSystem) { _ioHelper = ioHelper ?? throw new ArgumentNullException(nameof(ioHelper)); + _systemDirectories = Current.SystemDirectories; } #region Implementation of IRepository @@ -104,7 +106,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement } // validate path & extension - var validDir = SystemDirectories.Scripts; + var validDir = _systemDirectories.Scripts; var isValidPath = _ioHelper.VerifyEditPath(fullPath, validDir); var validExts = new[] {"js"}; var isValidExtension = _ioHelper.VerifyFileExtension(script.Path, validExts); diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/StylesheetRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/StylesheetRepository.cs index 94737b5620..de661d1f7e 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/StylesheetRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/StylesheetRepository.cs @@ -121,7 +121,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement } // validate path and extension - var validDir = SystemDirectories.Css; + var validDir = Current.SystemDirectories.Css; var isValidPath = _ioHelper.VerifyEditPath(fullPath, validDir); var isValidExtension = _ioHelper.VerifyFileExtension(stylesheet.Path, ValidExtensions); return isValidPath && isValidExtension; diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/TemplateRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/TemplateRepository.cs index 5fd319e4d4..b45ec5048b 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/TemplateRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/TemplateRepository.cs @@ -585,7 +585,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement var path = template.VirtualPath; // get valid paths - var validDirs = new[] { SystemDirectories.MvcViews }; + var validDirs = new[] { Current.SystemDirectories.MvcViews }; // get valid extensions var validExts = new List(); diff --git a/src/Umbraco.Core/Runtime/CoreInitialComponent.cs b/src/Umbraco.Core/Runtime/CoreInitialComponent.cs index f88417948b..0cb7024e66 100644 --- a/src/Umbraco.Core/Runtime/CoreInitialComponent.cs +++ b/src/Umbraco.Core/Runtime/CoreInitialComponent.cs @@ -10,10 +10,10 @@ namespace Umbraco.Core.Runtime // ensure we have some essential directories // every other component can then initialize safely Current.IOHelper.EnsurePathExists("~/App_Data"); - Current.IOHelper.EnsurePathExists(SystemDirectories.Media); - Current.IOHelper.EnsurePathExists(SystemDirectories.MvcViews); - Current.IOHelper.EnsurePathExists(SystemDirectories.MvcViews + "/Partials"); - Current.IOHelper.EnsurePathExists(SystemDirectories.MvcViews + "/MacroPartials"); + Current.IOHelper.EnsurePathExists(Current.SystemDirectories.Media); + Current.IOHelper.EnsurePathExists(Current.SystemDirectories.MvcViews); + Current.IOHelper.EnsurePathExists(Current.SystemDirectories.MvcViews + "/Partials"); + Current.IOHelper.EnsurePathExists(Current.SystemDirectories.MvcViews + "/MacroPartials"); } public void Terminate() diff --git a/src/Umbraco.Core/Services/Implement/FileService.cs b/src/Umbraco.Core/Services/Implement/FileService.cs index cde8ed30fe..afc30e09ce 100644 --- a/src/Umbraco.Core/Services/Implement/FileService.cs +++ b/src/Umbraco.Core/Services/Implement/FileService.cs @@ -664,7 +664,7 @@ namespace Umbraco.Core.Services.Implement public IEnumerable GetPartialViewSnippetNames(params string[] filterNames) { - var snippetPath = Current.IOHelper.MapPath($"{SystemDirectories.Umbraco}/PartialViewMacros/Templates/"); + var snippetPath = Current.IOHelper.MapPath($"{Current.SystemDirectories.Umbraco}/PartialViewMacros/Templates/"); var files = Directory.GetFiles(snippetPath, "*.cshtml") .Select(Path.GetFileNameWithoutExtension) .Except(filterNames, StringComparer.InvariantCultureIgnoreCase) @@ -898,7 +898,7 @@ namespace Umbraco.Core.Services.Implement fileName += ".cshtml"; } - var snippetPath = Current.IOHelper.MapPath($"{SystemDirectories.Umbraco}/PartialViewMacros/Templates/{fileName}"); + var snippetPath = Current.IOHelper.MapPath($"{Current.SystemDirectories.Umbraco}/PartialViewMacros/Templates/{fileName}"); return System.IO.File.Exists(snippetPath) ? Attempt.Succeed(snippetPath) : Attempt.Fail(); diff --git a/src/Umbraco.Core/Services/Implement/NotificationService.cs b/src/Umbraco.Core/Services/Implement/NotificationService.cs index 65040f625a..fa7b14abe4 100644 --- a/src/Umbraco.Core/Services/Implement/NotificationService.cs +++ b/src/Umbraco.Core/Services/Implement/NotificationService.cs @@ -384,7 +384,7 @@ namespace Umbraco.Core.Services.Implement var protocol = _globalSettings.UseHttps ? "https" : "http"; var subjectVars = new NotificationEmailSubjectParams( - string.Concat(siteUri.Authority, Current.IOHelper.ResolveUrl(SystemDirectories.Umbraco)), + string.Concat(siteUri.Authority, Current.IOHelper.ResolveUrl(Current.SystemDirectories.Umbraco)), actionName, content.Name); @@ -400,7 +400,7 @@ namespace Umbraco.Core.Services.Implement string.Concat(content.Id, ".aspx"), protocol), performingUser.Name, - string.Concat(siteUri.Authority, Current.IOHelper.ResolveUrl(SystemDirectories.Umbraco)), + string.Concat(siteUri.Authority, Current.IOHelper.ResolveUrl(Current.SystemDirectories.Umbraco)), summary.ToString()); // create the mail message diff --git a/src/Umbraco.Core/Services/Implement/PackagingService.cs b/src/Umbraco.Core/Services/Implement/PackagingService.cs index c0946e4468..f68685ee57 100644 --- a/src/Umbraco.Core/Services/Implement/PackagingService.cs +++ b/src/Umbraco.Core/Services/Implement/PackagingService.cs @@ -64,7 +64,7 @@ namespace Umbraco.Core.Services.Implement //successful if (bytes.Length > 0) { - var packagePath = Current.IOHelper.MapPath(SystemDirectories.Packages); + var packagePath = Current.IOHelper.MapPath(Current.SystemDirectories.Packages); // Check for package directory if (Directory.Exists(packagePath) == false) diff --git a/src/Umbraco.Core/Sync/ApplicationUrlHelper.cs b/src/Umbraco.Core/Sync/ApplicationUrlHelper.cs index b7afc1048b..b58aefe5dd 100644 --- a/src/Umbraco.Core/Sync/ApplicationUrlHelper.cs +++ b/src/Umbraco.Core/Sync/ApplicationUrlHelper.cs @@ -98,7 +98,7 @@ namespace Umbraco.Core.Sync : ""; var ssl = globalSettings.UseHttps ? "s" : ""; // force, whatever the first request - var url = "http" + ssl + "://" + request.ServerVariables["SERVER_NAME"] + port + Current.IOHelper.ResolveUrl(SystemDirectories.Umbraco); + var url = "http" + ssl + "://" + request.ServerVariables["SERVER_NAME"] + port + Current.IOHelper.ResolveUrl(Current.SystemDirectories.Umbraco); return url.TrimEnd('/'); } diff --git a/src/Umbraco.Examine/LuceneIndexCreator.cs b/src/Umbraco.Examine/LuceneIndexCreator.cs index 3834c1476e..f310ca9229 100644 --- a/src/Umbraco.Examine/LuceneIndexCreator.cs +++ b/src/Umbraco.Examine/LuceneIndexCreator.cs @@ -36,7 +36,7 @@ namespace Umbraco.Examine public virtual Lucene.Net.Store.Directory CreateFileSystemLuceneDirectory(string folderName) { - var dirInfo = new DirectoryInfo(Path.Combine(Current.IOHelper.MapPath(SystemDirectories.TempData), "ExamineIndexes", folderName)); + var dirInfo = new DirectoryInfo(Path.Combine(Current.IOHelper.MapPath(Current.SystemDirectories.TempData), "ExamineIndexes", folderName)); if (!dirInfo.Exists) System.IO.Directory.CreateDirectory(dirInfo.FullName); diff --git a/src/Umbraco.Examine/LuceneIndexDiagnostics.cs b/src/Umbraco.Examine/LuceneIndexDiagnostics.cs index 7a91552c81..0ed2d88085 100644 --- a/src/Umbraco.Examine/LuceneIndexDiagnostics.cs +++ b/src/Umbraco.Examine/LuceneIndexDiagnostics.cs @@ -72,7 +72,7 @@ namespace Umbraco.Examine if (luceneDir is FSDirectory fsDir) { - d[nameof(UmbracoExamineIndex.LuceneIndexFolder)] = fsDir.Directory.ToString().ToLowerInvariant().TrimStart(Current.IOHelper.MapPath(SystemDirectories.Root).ToLowerInvariant()).Replace("\\", "/").EnsureStartsWith('/'); + d[nameof(UmbracoExamineIndex.LuceneIndexFolder)] = fsDir.Directory.ToString().ToLowerInvariant().TrimStart(Current.IOHelper.MapPath(Current.SystemDirectories.Root).ToLowerInvariant()).Replace("\\", "/").EnsureStartsWith('/'); } return d; diff --git a/src/Umbraco.Tests/Configurations/GlobalSettingsTests.cs b/src/Umbraco.Tests/Configurations/GlobalSettingsTests.cs index 69a9613a38..bab6a13dad 100644 --- a/src/Umbraco.Tests/Configurations/GlobalSettingsTests.cs +++ b/src/Umbraco.Tests/Configurations/GlobalSettingsTests.cs @@ -17,13 +17,13 @@ namespace Umbraco.Tests.Configurations public override void SetUp() { base.SetUp(); - _root = SystemDirectories.Root; + _root = Current.SystemDirectories.Root; } public override void TearDown() { base.TearDown(); - SystemDirectories.Root = _root; + Current.SystemDirectories.Root = _root; } [Test] @@ -51,7 +51,7 @@ namespace Umbraco.Tests.Configurations var globalSettingsMock = Mock.Get(globalSettings); globalSettingsMock.Setup(x => x.Path).Returns(() => Current.IOHelper.ResolveUrl(path)); - SystemDirectories.Root = rootPath; + Current.SystemDirectories.Root = rootPath; Assert.AreEqual(outcome, globalSettings.GetUmbracoMvcAreaNoCache()); } diff --git a/src/Umbraco.Tests/CoreThings/UriExtensionsTests.cs b/src/Umbraco.Tests/CoreThings/UriExtensionsTests.cs index be7aec631e..d3d5548a1d 100644 --- a/src/Umbraco.Tests/CoreThings/UriExtensionsTests.cs +++ b/src/Umbraco.Tests/CoreThings/UriExtensionsTests.cs @@ -1,6 +1,7 @@ using System; using NUnit.Framework; using Umbraco.Core; +using Umbraco.Core.Composing; using Umbraco.Core.IO; using Umbraco.Tests.TestHelpers; @@ -14,13 +15,13 @@ namespace Umbraco.Tests.CoreThings [SetUp] public void SetUp() { - _root = SystemDirectories.Root; + _root = Current.SystemDirectories.Root; } [TearDown] public void TearDown() { - SystemDirectories.Root = _root; + Current.SystemDirectories.Root = _root; } [TestCase("http://www.domain.com/umbraco", "", true)] @@ -32,7 +33,7 @@ namespace Umbraco.Tests.CoreThings [TestCase("http://www.domain.com/umbraco/test/test.js", "", true)] [TestCase("http://www.domain.com/umbrac", "", false)] [TestCase("http://www.domain.com/test", "", false)] - [TestCase("http://www.domain.com/test/umbraco", "", false)] + [TestCase("http://www.domain.com/test/umbraco", "", false)] [TestCase("http://www.domain.com/Umbraco/Backoffice/blah", "", true)] [TestCase("http://www.domain.com/Umbraco/anything", "", true)] [TestCase("http://www.domain.com/Umbraco/anything/", "", true)] @@ -44,7 +45,7 @@ namespace Umbraco.Tests.CoreThings [TestCase("http://www.domain.com/umbraco/test/legacyAjaxCalls.ashx?some=query&blah=js", "", true)] public void Is_Back_Office_Request(string input, string virtualPath, bool expected) { - SystemDirectories.Root = virtualPath; + Current.SystemDirectories.Root = virtualPath; var globalConfig = SettingsForTests.GenerateMockGlobalSettings(); var source = new Uri(input); Assert.AreEqual(expected, source.IsBackOfficeRequest(virtualPath, globalConfig)); @@ -58,7 +59,7 @@ namespace Umbraco.Tests.CoreThings [TestCase("http://www.domain.com/install/test/test.js", true)] [TestCase("http://www.domain.com/instal", false)] [TestCase("http://www.domain.com/umbraco", false)] - [TestCase("http://www.domain.com/umbraco/umbraco", false)] + [TestCase("http://www.domain.com/umbraco/umbraco", false)] public void Is_Installer_Request(string input, bool expected) { var source = new Uri(input); diff --git a/src/Umbraco.Tests/IO/IoHelperTests.cs b/src/Umbraco.Tests/IO/IoHelperTests.cs index 2a7e633e4f..5ca335db25 100644 --- a/src/Umbraco.Tests/IO/IoHelperTests.cs +++ b/src/Umbraco.Tests/IO/IoHelperTests.cs @@ -9,6 +9,8 @@ namespace Umbraco.Tests.IO [TestFixture] public class IoHelperTests { + private ISystemDirectories SystemDirectories => Current.SystemDirectories; + [TestCase("~/Scripts", "/Scripts", null)] [TestCase("/Scripts", "/Scripts", null)] [TestCase("../Scripts", "/Scripts", typeof(ArgumentException))] diff --git a/src/Umbraco.Tests/IO/ShadowFileSystemTests.cs b/src/Umbraco.Tests/IO/ShadowFileSystemTests.cs index 409fae6081..2e8c6c110f 100644 --- a/src/Umbraco.Tests/IO/ShadowFileSystemTests.cs +++ b/src/Umbraco.Tests/IO/ShadowFileSystemTests.cs @@ -41,7 +41,7 @@ namespace Umbraco.Tests.IO private static void ClearFiles() { TestHelper.DeleteDirectory(Current.IOHelper.MapPath("FileSysTests")); - TestHelper.DeleteDirectory(Current.IOHelper.MapPath(SystemDirectories.TempData.EnsureEndsWith('/') + "ShadowFs")); + TestHelper.DeleteDirectory(Current.IOHelper.MapPath(Current.SystemDirectories.TempData.EnsureEndsWith('/') + "ShadowFs")); } private static string NormPath(string path) @@ -388,7 +388,7 @@ namespace Umbraco.Tests.IO var logger = Mock.Of(); var path = Current.IOHelper.MapPath("FileSysTests"); - var shadowfs = Current.IOHelper.MapPath(SystemDirectories.TempData.EnsureEndsWith('/') + "ShadowFs"); + var shadowfs = Current.IOHelper.MapPath(Current.SystemDirectories.TempData.EnsureEndsWith('/') + "ShadowFs"); Directory.CreateDirectory(path); Directory.CreateDirectory(shadowfs); @@ -483,7 +483,7 @@ namespace Umbraco.Tests.IO var logger = Mock.Of(); var path = Current.IOHelper.MapPath("FileSysTests"); - var shadowfs = Current.IOHelper.MapPath(SystemDirectories.TempData.EnsureEndsWith('/') + "ShadowFs"); + var shadowfs = Current.IOHelper.MapPath(Current.SystemDirectories.TempData.EnsureEndsWith('/') + "ShadowFs"); Directory.CreateDirectory(path); var scopedFileSystems = false; @@ -536,7 +536,7 @@ namespace Umbraco.Tests.IO var logger = Mock.Of(); var path = Current.IOHelper.MapPath("FileSysTests"); - var shadowfs = Current.IOHelper.MapPath(SystemDirectories.TempData.EnsureEndsWith('/') + "ShadowFs"); + var shadowfs = Current.IOHelper.MapPath(Current.SystemDirectories.TempData.EnsureEndsWith('/') + "ShadowFs"); Directory.CreateDirectory(path); var scopedFileSystems = false; diff --git a/src/Umbraco.Tests/LegacyXmlPublishedCache/PreviewContent.cs b/src/Umbraco.Tests/LegacyXmlPublishedCache/PreviewContent.cs index adbd15b16a..f023eb9446 100644 --- a/src/Umbraco.Tests/LegacyXmlPublishedCache/PreviewContent.cs +++ b/src/Umbraco.Tests/LegacyXmlPublishedCache/PreviewContent.cs @@ -108,7 +108,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache _previewXml = _xmlStore.GetPreviewXml(contentId, includeSubs); // make sure the preview folder exists - var dir = new DirectoryInfo(Current.IOHelper.MapPath(SystemDirectories.Preview)); + var dir = new DirectoryInfo(Current.IOHelper.MapPath(Current.SystemDirectories.Preview)); if (dir.Exists == false) dir.Create(); @@ -122,7 +122,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache // get the full path to the preview set private static string GetPreviewSetPath(int userId, Guid previewSet) { - return Current.IOHelper.MapPath(Path.Combine(SystemDirectories.Preview, userId + "_" + previewSet + ".config")); + return Current.IOHelper.MapPath(Path.Combine(Current.SystemDirectories.Preview, userId + "_" + previewSet + ".config")); } // deletes files for the user, and files accessed more than one hour ago diff --git a/src/Umbraco.Tests/Persistence/Repositories/PartialViewRepositoryTests.cs b/src/Umbraco.Tests/Persistence/Repositories/PartialViewRepositoryTests.cs index 9c326b3ddc..8c47d709f2 100644 --- a/src/Umbraco.Tests/Persistence/Repositories/PartialViewRepositoryTests.cs +++ b/src/Umbraco.Tests/Persistence/Repositories/PartialViewRepositoryTests.cs @@ -1,6 +1,7 @@ using System.Linq; using Moq; using NUnit.Framework; +using Umbraco.Core.Composing; using Umbraco.Core.IO; using Umbraco.Core.Models; using Umbraco.Core.PropertyEditors; @@ -20,7 +21,7 @@ namespace Umbraco.Tests.Persistence.Repositories { base.SetUp(); - _fileSystem = new PhysicalFileSystem(SystemDirectories.MvcViews + "/Partials/"); + _fileSystem = new PhysicalFileSystem(Current.SystemDirectories.MvcViews + "/Partials/"); } protected override void Compose() diff --git a/src/Umbraco.Tests/Persistence/Repositories/ScriptRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/ScriptRepositoryTest.cs index ae0c71a5b3..cd3a2dae2b 100644 --- a/src/Umbraco.Tests/Persistence/Repositories/ScriptRepositoryTest.cs +++ b/src/Umbraco.Tests/Persistence/Repositories/ScriptRepositoryTest.cs @@ -3,6 +3,7 @@ using System.Linq; using System.Text; using Moq; using NUnit.Framework; +using Umbraco.Core.Composing; using Umbraco.Core.Configuration.UmbracoSettings; using Umbraco.Core.IO; using Umbraco.Core.Models; @@ -26,7 +27,7 @@ namespace Umbraco.Tests.Persistence.Repositories base.SetUp(); _fileSystems = Mock.Of(); - _fileSystem = new PhysicalFileSystem(SystemDirectories.Scripts); + _fileSystem = new PhysicalFileSystem(Current.SystemDirectories.Scripts); Mock.Get(_fileSystems).Setup(x => x.ScriptsFileSystem).Returns(_fileSystem); using (var stream = CreateStream("Umbraco.Sys.registerNamespace(\"Umbraco.Utils\");")) { @@ -36,7 +37,7 @@ namespace Umbraco.Tests.Persistence.Repositories private IScriptRepository CreateRepository() { - return new ScriptRepository(_fileSystems, new IOHelper()); + return new ScriptRepository(_fileSystems, IOHelper); } protected override void Compose() diff --git a/src/Umbraco.Tests/Persistence/Repositories/StylesheetRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/StylesheetRepositoryTest.cs index 2358fb257d..a21222e4d2 100644 --- a/src/Umbraco.Tests/Persistence/Repositories/StylesheetRepositoryTest.cs +++ b/src/Umbraco.Tests/Persistence/Repositories/StylesheetRepositoryTest.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text; using Moq; using NUnit.Framework; +using Umbraco.Core.Composing; using Umbraco.Core.IO; using Umbraco.Core.Models; using Umbraco.Core.Persistence.Repositories; @@ -25,7 +26,7 @@ namespace Umbraco.Tests.Persistence.Repositories base.SetUp(); _fileSystems = Mock.Of(); - _fileSystem = new PhysicalFileSystem(SystemDirectories.Css); + _fileSystem = new PhysicalFileSystem(Current.SystemDirectories.Css); Mock.Get(_fileSystems).Setup(x => x.StylesheetsFileSystem).Returns(_fileSystem); var stream = CreateStream("body {background:#EE7600; color:#FFF;}"); _fileSystem.AddFile("styles.css", stream); @@ -33,7 +34,7 @@ namespace Umbraco.Tests.Persistence.Repositories private IStylesheetRepository CreateRepository() { - return new StylesheetRepository(_fileSystems, new IOHelper()); + return new StylesheetRepository(_fileSystems, IOHelper); } [Test] diff --git a/src/Umbraco.Tests/Persistence/Repositories/TemplateRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/TemplateRepositoryTest.cs index b0f9a5335b..c7eb9ed4f6 100644 --- a/src/Umbraco.Tests/Persistence/Repositories/TemplateRepositoryTest.cs +++ b/src/Umbraco.Tests/Persistence/Repositories/TemplateRepositoryTest.cs @@ -7,6 +7,7 @@ using Moq; using NUnit.Framework; using Umbraco.Core; using Umbraco.Core.Cache; +using Umbraco.Core.Composing; using Umbraco.Core.Configuration.UmbracoSettings; using Umbraco.Core.IO; using Umbraco.Core.Models; @@ -35,7 +36,7 @@ namespace Umbraco.Tests.Persistence.Repositories base.SetUp(); _fileSystems = Mock.Of(); - var viewsFileSystem = new PhysicalFileSystem(SystemDirectories.MvcViews); + var viewsFileSystem = new PhysicalFileSystem(Current.SystemDirectories.MvcViews); Mock.Get(_fileSystems).Setup(x => x.MvcViewsFileSystem).Returns(viewsFileSystem); } @@ -63,7 +64,7 @@ namespace Umbraco.Tests.Persistence.Repositories // Act var template = new Template("test", "test"); repository.Save(template); - + //Assert Assert.That(repository.Get("test"), Is.Not.Null); @@ -526,7 +527,7 @@ namespace Umbraco.Tests.Persistence.Repositories _fileSystems = null; //Delete all files - var fsViews = new PhysicalFileSystem(SystemDirectories.MvcViews); + var fsViews = new PhysicalFileSystem(Current.SystemDirectories.MvcViews); var views = fsViews.GetFiles("", "*.cshtml"); foreach (var file in views) fsViews.DeleteFile(file); @@ -615,7 +616,7 @@ namespace Umbraco.Tests.Persistence.Repositories repository.Save(toddler4); repository.Save(baby1); repository.Save(baby2); - + return new[] {parent, child1, child2, toddler1, toddler2, toddler3, toddler4, baby1, baby2}; } diff --git a/src/Umbraco.Tests/Scoping/ScopeFileSystemsTests.cs b/src/Umbraco.Tests/Scoping/ScopeFileSystemsTests.cs index 305ae70be9..1f49e83202 100644 --- a/src/Umbraco.Tests/Scoping/ScopeFileSystemsTests.cs +++ b/src/Umbraco.Tests/Scoping/ScopeFileSystemsTests.cs @@ -46,7 +46,7 @@ namespace Umbraco.Tests.Scoping { TestHelper.DeleteDirectory(Current.IOHelper.MapPath("media")); TestHelper.DeleteDirectory(Current.IOHelper.MapPath("FileSysTests")); - TestHelper.DeleteDirectory(Current.IOHelper.MapPath(SystemDirectories.TempData.EnsureEndsWith('/') + "ShadowFs")); + TestHelper.DeleteDirectory(Current.IOHelper.MapPath(Current.SystemDirectories.TempData.EnsureEndsWith('/') + "ShadowFs")); } [TestCase(true)] diff --git a/src/Umbraco.Tests/TestHelpers/TestHelper.cs b/src/Umbraco.Tests/TestHelpers/TestHelper.cs index f9365c5526..9e5995cfb5 100644 --- a/src/Umbraco.Tests/TestHelpers/TestHelper.cs +++ b/src/Umbraco.Tests/TestHelpers/TestHelper.cs @@ -69,12 +69,12 @@ namespace Umbraco.Tests.TestHelpers public static void InitializeContentDirectories() { - CreateDirectories(new[] { SystemDirectories.MvcViews, SystemDirectories.Media, SystemDirectories.AppPlugins }); + CreateDirectories(new[] { Current.SystemDirectories.MvcViews, Current.SystemDirectories.Media, Current.SystemDirectories.AppPlugins }); } public static void CleanContentDirectories() { - CleanDirectories(new[] { SystemDirectories.MvcViews, SystemDirectories.Media }); + CleanDirectories(new[] { Current.SystemDirectories.MvcViews, Current.SystemDirectories.Media }); } public static void CreateDirectories(string[] directories) @@ -91,7 +91,7 @@ namespace Umbraco.Tests.TestHelpers { var preserves = new Dictionary { - { SystemDirectories.MvcViews, new[] {"dummy.txt"} } + { Current.SystemDirectories.MvcViews, new[] {"dummy.txt"} } }; foreach (var directory in directories) { diff --git a/src/Umbraco.Tests/TestHelpers/TestObjects.cs b/src/Umbraco.Tests/TestHelpers/TestObjects.cs index 280632fdae..0e838bbf24 100644 --- a/src/Umbraco.Tests/TestHelpers/TestObjects.cs +++ b/src/Umbraco.Tests/TestHelpers/TestObjects.cs @@ -118,9 +118,9 @@ namespace Umbraco.Tests.TestHelpers var localizedTextService = GetLazyService(factory, c => new LocalizedTextService( new Lazy(() => { - var mainLangFolder = new DirectoryInfo(Current.IOHelper.MapPath(SystemDirectories.Umbraco + "/config/lang/")); - var appPlugins = new DirectoryInfo(Current.IOHelper.MapPath(SystemDirectories.AppPlugins)); - var configLangFolder = new DirectoryInfo(Current.IOHelper.MapPath(SystemDirectories.Config + "/lang/")); + var mainLangFolder = new DirectoryInfo(Current.IOHelper.MapPath(Current.SystemDirectories.Umbraco + "/config/lang/")); + var appPlugins = new DirectoryInfo(Current.IOHelper.MapPath(Current.SystemDirectories.AppPlugins)); + var configLangFolder = new DirectoryInfo(Current.IOHelper.MapPath(Current.SystemDirectories.Config + "/lang/")); var pluginLangFolders = appPlugins.Exists == false ? Enumerable.Empty() diff --git a/src/Umbraco.Web.UI/Umbraco/Views/AuthorizeUpgrade.cshtml b/src/Umbraco.Web.UI/Umbraco/Views/AuthorizeUpgrade.cshtml index 59568b508e..9f7a532fe0 100644 --- a/src/Umbraco.Web.UI/Umbraco/Views/AuthorizeUpgrade.cshtml +++ b/src/Umbraco.Web.UI/Umbraco/Views/AuthorizeUpgrade.cshtml @@ -33,7 +33,7 @@ Umbraco @Html.RenderCssHere( - new BasicPath("Umbraco", Current.IOHelper.ResolveUrl(SystemDirectories.Umbraco))) + new BasicPath("Umbraco", Current.IOHelper.ResolveUrl(Current.SystemDirectories.Umbraco))) @*Because we're lazy loading angular js, the embedded cloak style will not be loaded initially, but we need it*@