Skip to content

Commit

Permalink
force create cover directory for resource before migrating covers;
Browse files Browse the repository at this point in the history
  • Loading branch information
anobaka committed Sep 5, 2024
1 parent fec77a4 commit 2ad99f5
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/miscellaneous/Bakabase.Migrations/V190/V190Migrator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ private async Task MigrateCustomProperties()
var newResourceCoverDir =
Path.Combine(newCoverRootDir, resourceId.ToString());
var subFiles = Directory.GetFiles(sd, "*", SearchOption.AllDirectories);
Directory.CreateDirectory(newResourceCoverDir);
try
{
foreach (var sf in subFiles)
Expand All @@ -356,11 +357,14 @@ private async Task MigrateCustomProperties()
$"Failed to migrate cover files for resource {resourceId}.");
}

var covers = Directory.GetFiles(newResourceCoverDir);
if (covers.Any())
if (Directory.Exists(newResourceCoverDir))
{
resourceBizValueMap[resourceId] =
new ListStringValueBuilder(covers.ToList()).Value;
var covers = Directory.GetFiles(newResourceCoverDir);
if (covers.Any())
{
resourceBizValueMap[resourceId] =
new ListStringValueBuilder(covers.ToList()).Value;
}
}
}
}
Expand Down

0 comments on commit 2ad99f5

Please sign in to comment.