From 2ad99f53fde16657f42edeace9a515a18221ddcf Mon Sep 17 00:00:00 2001 From: anobaka Date: Thu, 5 Sep 2024 23:02:23 +0800 Subject: [PATCH] force create cover directory for resource before migrating covers; --- .../Bakabase.Migrations/V190/V190Migrator.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/miscellaneous/Bakabase.Migrations/V190/V190Migrator.cs b/src/miscellaneous/Bakabase.Migrations/V190/V190Migrator.cs index caa3a05f..935f8a6c 100644 --- a/src/miscellaneous/Bakabase.Migrations/V190/V190Migrator.cs +++ b/src/miscellaneous/Bakabase.Migrations/V190/V190Migrator.cs @@ -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) @@ -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; + } } } }