diff --git a/implementations/Crafter.Build-Project.cpp b/implementations/Crafter.Build-Project.cpp index af5d725..debee80 100644 --- a/implementations/Crafter.Build-Project.cpp +++ b/implementations/Crafter.Build-Project.cpp @@ -165,15 +165,22 @@ namespace Crafter { } command += std::format(" -fprebuilt-module-path={} -fprebuilt-module-path={}/wasi-sysroot-28.0/share/libc++/v1", pcmDir.string(), exeDir); + const fs::path indexPath = std::format("{}/index.html", exeDir); const fs::path indexDstPath = binDir/"index.html"; - if(!fs::exists(indexDstPath) || fs::last_write_time(indexDstPath) < fs::last_write_time(indexPath)) { + if(!fs::exists(indexDstPath)) { + fs::copy(indexPath, indexDstPath); + } else if(fs::last_write_time(indexDstPath) < fs::last_write_time(indexPath)) { + fs::remove(indexDstPath); fs::copy(indexPath, indexDstPath); } const fs::path runtimePath = std::format("{}/runtime.js", exeDir); const fs::path runtimeDstPath = binDir/"runtime.js"; - if(!fs::exists(runtimeDstPath) || fs::last_write_time(runtimeDstPath) < fs::last_write_time(runtimePath)) { + if(!fs::exists(runtimeDstPath)) { + fs::copy(runtimePath, runtimeDstPath); + } else if(fs::last_write_time(runtimeDstPath) < fs::last_write_time(runtimePath)) { + fs::remove(runtimeDstPath); fs::copy(runtimePath, runtimeDstPath); } }