Skip to content

Commit

Permalink
Change App_Files to App_Data
Browse files Browse the repository at this point in the history
  • Loading branch information
mythz committed Nov 6, 2023
1 parent a770aba commit cbc83f8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion BlazorDiffusion/Configure.AppHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public override void Configure(Container container)

var s3Client = container.Resolve<AmazonS3Client>();

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,
Expand Down
18 changes: 8 additions & 10 deletions BlazorDiffusion/Migrations/Migration1001.cs
Original file line number Diff line number Diff line change
Expand Up @@ -348,17 +348,15 @@ public override void Up()
// Import Creatives + Artifacts
var allArtifactLikeRefs = File.ReadAllText(seedDir.CombineWith("artifact-likes.csv"))
.FromCsv<List<ArtifactLikeRef>>();
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<Creative>();
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit cbc83f8

Please sign in to comment.