/src/Umbraco.Web/umbraco.presentation/EnsureSystemPathsApplicationStartupHandler.cs
https://github.com/solracnapod/Umbraco-CMS · C# · 41 lines · 38 code · 3 blank · 0 comment · 1 complexity · 20af9788f7a32a457d71755697c2e854 MD5 · raw file
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Web;
- using Umbraco.Core;
- using Umbraco.Core.IO;
- using umbraco.businesslogic;
- using umbraco.interfaces;
-
- namespace umbraco.presentation
- {
- public class EnsureSystemPathsApplicationStartupHandler : ApplicationEventHandler
- {
- protected override void ApplicationInitialized(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
- {
- base.ApplicationInitialized(umbracoApplication, applicationContext);
-
- EnsurePathExists("~/App_Code");
- EnsurePathExists("~/App_Data");
- EnsurePathExists(SystemDirectories.AppPlugins);
- EnsurePathExists(SystemDirectories.Css);
- EnsurePathExists(SystemDirectories.MacroScripts);
- EnsurePathExists(SystemDirectories.Masterpages);
- EnsurePathExists(SystemDirectories.Media);
- EnsurePathExists(SystemDirectories.Scripts);
- EnsurePathExists(SystemDirectories.UserControls);
- EnsurePathExists(SystemDirectories.Xslt);
- EnsurePathExists(SystemDirectories.MvcViews);
- EnsurePathExists(SystemDirectories.MvcViews + "/Partials");
- EnsurePathExists(SystemDirectories.MvcViews + "/MacroPartials");
- }
-
- public void EnsurePathExists(string path)
- {
- var absolutePath = IOHelper.MapPath(path);
- if (!Directory.Exists(absolutePath))
- Directory.CreateDirectory(absolutePath);
- }
- }
- }