EnsureTemplateFolderExists() public method

Creates a directory and copies the needed web.config for razor files if the directory does not exist.
public EnsureTemplateFolderExists ( string templateLocation ) : void
templateLocation string
return void
示例#1
0
 // todo: try to cache the result of settings-stored in a static variable, this full check
 // todo: shouldn't have to happen every time
 /// <summary>
 /// Returns true if the Portal HomeDirectory Contains the 2sxc Folder and this folder contains the web.config and a Content folder
 /// </summary>
 public void EnsurePortalIsConfigured(SxcInstance sxc, HttpServerUtility server, string controlPath)
 {
     var sexyFolder = new DirectoryInfo(server.MapPath(Path.Combine(sxc.AppPortalSettings.HomeDirectory, Settings.TemplateFolder)));
     var contentFolder = new DirectoryInfo(Path.Combine(sexyFolder.FullName, Constants.ContentAppName));
     var webConfigTemplate = new FileInfo(Path.Combine(sexyFolder.FullName, Settings.WebConfigFileName));
     if (!(sexyFolder.Exists && webConfigTemplate.Exists && contentFolder.Exists))
     {
         // configure it
         var tm = new TemplateManager(sxc.App);
         tm.EnsureTemplateFolderExists(Settings.TemplateLocations.PortalFileSystem);
     };
 }
示例#2
0
        // todo: try to cache the result of settings-stored in a static variable, this full check
        // todo: shouldn't have to happen every time

        /// <summary>
        /// Returns true if the Portal HomeDirectory Contains the 2sxc Folder and this folder contains the web.config and a Content folder
        /// </summary>
        public void EnsurePortalIsConfigured(SxcInstance sxc, HttpServerUtility server, string controlPath)
        {
            var sexyFolder        = new DirectoryInfo(server.MapPath(Path.Combine(sxc.AppPortalSettings.HomeDirectory, Settings.TemplateFolder)));
            var contentFolder     = new DirectoryInfo(Path.Combine(sexyFolder.FullName, "Content"));
            var webConfigTemplate = new FileInfo(Path.Combine(sexyFolder.FullName, Settings.WebConfigFileName));

            if (!(sexyFolder.Exists && webConfigTemplate.Exists && contentFolder.Exists))
            {
                // configure it
                var tm = new TemplateManager(sxc.App);
                tm.EnsureTemplateFolderExists(server, Settings.TemplateLocations.PortalFileSystem);
            }
            ;
        }