private static void AddAssetsToBuilder(GeneratedSite entity, JobBuilder builder) { if (!string.IsNullOrEmpty(entity.AssetPaths)) { var splitPaths = entity.AssetPaths.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); var rootPath = HostingEnvironment.MapPath("~/"); foreach (var path in splitPaths) { var absolutePath = FileHelpers.PathCombine(rootPath, path); if (path.Contains("?") || path.Contains("*")) { var trimmedPath = path.TrimStart(new[] { '\\', '/' }); var directory = new DirectoryInfo(rootPath); var files = directory.GetFiles(trimmedPath, SearchOption.AllDirectories); builder.AddAssetFiles(files.Select(f => "/" + FileHelpers.GetRelativePath(rootPath, f.FullName))); } else if (Directory.Exists(absolutePath)) { builder.AddAssetFolder(path); } else if (System.IO.File.Exists(absolutePath)) { builder.AddAssetFile(path); } else { // Invalid file. } } } }