﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
using Umbraco.Core.IO;
using umbraco.businesslogic;
using umbraco.interfaces;

namespace umbraco.presentation
{
    public class EnsureSystemPathsApplicationStartupHandler : IApplicationStartupHandler
    {
        public EnsureSystemPathsApplicationStartupHandler()
        {
            EnsurePathExists(SystemDirectories.Css);
            EnsurePathExists(SystemDirectories.Data);
            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);
        }
    }
}
﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
using Umbraco.Core.IO;
using umbraco.businesslogic;
using umbraco.interfaces;

namespace umbraco.presentation
{
    public class EnsureSystemPathsApplicationStartupHandler : IApplicationStartupHandler
    {
        public EnsureSystemPathsApplicationStartupHandler()
        {
            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);
        }
    }
}
Add App_Code, App_Data and App_Plugins folders to be created during app startup
Add App_Code, App_Data and App_Plugins folders to be created during app startup
