From cbc83f8425b0515a18c9ec2ea6b542147ad9e7c4 Mon Sep 17 00:00:00 2001 From: Demis Bellot Date: Mon, 6 Nov 2023 13:14:40 +0800 Subject: [PATCH] Change App_Files to App_Data --- BlazorDiffusion/Configure.AppHost.cs | 2 +- BlazorDiffusion/Migrations/Migration1001.cs | 18 ++++++++---------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/BlazorDiffusion/Configure.AppHost.cs b/BlazorDiffusion/Configure.AppHost.cs index 15ef792..13c6f0e 100644 --- a/BlazorDiffusion/Configure.AppHost.cs +++ b/BlazorDiffusion/Configure.AppHost.cs @@ -101,7 +101,7 @@ public override void Configure(Container container) var s3Client = container.Resolve(); - var localFs = new FileSystemVirtualFiles(ContentRootDirectory.RealPath.CombineWith("App_Files").AssertDir()); + var localFs = new FileSystemVirtualFiles(ContentRootDirectory.RealPath.CombineWith("App_Data").AssertDir()); var appFs = VirtualFiles = hasR2 ? new R2VirtualFiles(s3Client, appConfig.ArtifactBucket) : localFs; Plugins.Add(new FilesUploadFeature( new UploadLocation("artifacts", appFs, diff --git a/BlazorDiffusion/Migrations/Migration1001.cs b/BlazorDiffusion/Migrations/Migration1001.cs index 450c57f..45305e9 100644 --- a/BlazorDiffusion/Migrations/Migration1001.cs +++ b/BlazorDiffusion/Migrations/Migration1001.cs @@ -348,17 +348,15 @@ public override void Up() // Import Creatives + Artifacts var allArtifactLikeRefs = File.ReadAllText(seedDir.CombineWith("artifact-likes.csv")) .FromCsv>(); - var appFiles = new DirectoryInfo("./App_Files"); - if (!appFiles.Exists) - appFiles.Create(); + var appData = new DirectoryInfo("./App_Data"); + if (!appData.Exists) + appData.Create(); - - var seedFromDirectory = new DirectoryInfo("./App_Files/artifacts"); + var seedFromDirectory = new DirectoryInfo("./App_Data/artifacts"); if (!seedFromDirectory.Exists) { - return; - //seedFromDirectory.Create(); - //FetchDemoAssets(); + seedFromDirectory.Create(); + FetchDemoAssets(); } var filesToLoad = seedFromDirectory.GetMatchingFiles("*metadata.json").OrderBy(x => x); var creativeEntries = new List(); @@ -424,7 +422,7 @@ public override void Up() { artifact.Id = 0; artifact.CreativeId = id; - var filePath = $"./App_Files/{artifact.FilePath}"; + var filePath = $"./App_Data/{artifact.FilePath}"; artifact.Id = (int)Db.Insert(artifact, selectIdentity: true); artifactRefIdsMap[artifact.RefId] = artifact.Id; @@ -520,7 +518,7 @@ public static void FetchDemoAssets() using var zipStream = "https://github.com/NetCoreApps/BlazorDiffusionAssets/archive/refs/heads/master.zip" .GetStreamFromUrl(); var zipArchive = new ZipArchive(zipStream); - var appFiles = new DirectoryInfo("./App_Files"); + var appFiles = new DirectoryInfo("./App_Data"); foreach (var entry in zipArchive.Entries) { using var stream = entry.Open();