private void ConfigureFileSystem(IHostEnvironment hostEnvironment) { hostEnvironment.ContentRootFileProvider = new LocalFileSystem(hostEnvironment.ContentRootPath); if (hostEnvironment is IWebHostEnvironment we) { we.WebRootFileProvider = new LocalFileSystem(we.WebRootPath); WebRoot = (IFileSystem)we.WebRootFileProvider; } else { WebRoot = (IFileSystem)hostEnvironment.ContentRootFileProvider; } // TODO: (core) Read stuff from config and resolve tenant. Check folders and create them also. ThemesRoot = new LocalFileSystem(ContentRoot.MapPath("Themes")); ModulesRoot = new LocalFileSystem(ContentRoot.MapPath("Modules")); AppDataRoot = new LocalFileSystem(ContentRoot.MapPath("App_Data")); if (!AppDataRoot.DirectoryExists("Tenants")) { AppDataRoot.TryCreateDirectory("Tenants"); } CommonHelper.ContentRoot = ContentRoot; WebHelper.WebRoot = WebRoot; }
public void SetupCodeTreeTemplates(string pathToCodeTreeTemplates) { if (LocalFileSystem.DirectoryExists(pathToCodeTreeTemplates)) { LocalFileSystem.CopyDirectory(pathToCodeTreeTemplates, TargetFileSystem, InstallationPath); IEnumerable <string> configFileTemplatess = LocalFileSystem.EnumerateFiles(pathToCodeTreeTemplates, recursive: true); foreach (string configFileTemplate in configFileTemplatess) { string configRelativePath = BaseFileSystem.GetRelativePath(LocalFileSystem, pathToCodeTreeTemplates, configFileTemplate); string configPath = BaseFileSystem.CombinePaths(InstallationPath, configRelativePath); EnvironmentHelper.ExpandEnvironmentVariablesInConfig(configPath, TargetFileSystem); } } }