mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-07-04 04:02:56 +00:00
Fixed the web asset update logic in the build script (#509)
This commit is contained in:
parent
4db31fd9cf
commit
7843426057
@ -20,6 +20,7 @@ public sealed class UpdateWebAssetsCommand
|
|||||||
var rid = Environment.GetCurrentRid();
|
var rid = Environment.GetCurrentRid();
|
||||||
var cwd = Environment.GetAIStudioDirectory();
|
var cwd = Environment.GetAIStudioDirectory();
|
||||||
var contentPath = Path.Join(cwd, "bin", "release", Environment.DOTNET_VERSION, rid.AsMicrosoftRid(), "publish", "wwwroot", "_content");
|
var contentPath = Path.Join(cwd, "bin", "release", Environment.DOTNET_VERSION, rid.AsMicrosoftRid(), "publish", "wwwroot", "_content");
|
||||||
|
|
||||||
var isMudBlazorDirectoryPresent = Directory.Exists(Path.Join(contentPath, "MudBlazor"));
|
var isMudBlazorDirectoryPresent = Directory.Exists(Path.Join(contentPath, "MudBlazor"));
|
||||||
if (!isMudBlazorDirectoryPresent)
|
if (!isMudBlazorDirectoryPresent)
|
||||||
{
|
{
|
||||||
@ -28,14 +29,21 @@ public sealed class UpdateWebAssetsCommand
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Directory.CreateDirectory(Path.Join(cwd, "wwwroot", "system"));
|
var destinationPath = Path.Join(cwd, "wwwroot", "system");
|
||||||
|
if(Directory.Exists(destinationPath))
|
||||||
|
Directory.Delete(destinationPath, true);
|
||||||
|
|
||||||
|
Directory.CreateDirectory(destinationPath);
|
||||||
|
|
||||||
var sourcePaths = Directory.EnumerateFiles(contentPath, "*", SearchOption.AllDirectories);
|
var sourcePaths = Directory.EnumerateFiles(contentPath, "*", SearchOption.AllDirectories);
|
||||||
var counter = 0;
|
var counter = 0;
|
||||||
foreach(var sourcePath in sourcePaths)
|
foreach(var sourcePath in sourcePaths)
|
||||||
{
|
{
|
||||||
counter++;
|
counter++;
|
||||||
var relativePath = Path.GetRelativePath(cwd, sourcePath);
|
var relativePath = sourcePath
|
||||||
var targetPath = Path.Join(cwd, "wwwroot", relativePath);
|
.Replace(contentPath, "")
|
||||||
|
.TrimStart(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
|
||||||
|
var targetPath = Path.Join(cwd, "wwwroot", "system", relativePath);
|
||||||
var targetDirectory = Path.GetDirectoryName(targetPath);
|
var targetDirectory = Path.GetDirectoryName(targetPath);
|
||||||
if (targetDirectory != null)
|
if (targetDirectory != null)
|
||||||
Directory.CreateDirectory(targetDirectory);
|
Directory.CreateDirectory(targetDirectory);
|
||||||
|
Loading…
Reference in New Issue
Block a user