This commit is contained in:
Jorijn van der Graaf 2025-11-12 23:20:05 +01:00
commit d35871edd1

View file

@ -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); 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 indexPath = std::format("{}/index.html", exeDir);
const fs::path indexDstPath = binDir/"index.html"; 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); fs::copy(indexPath, indexDstPath);
} }
const fs::path runtimePath = std::format("{}/runtime.js", exeDir); const fs::path runtimePath = std::format("{}/runtime.js", exeDir);
const fs::path runtimeDstPath = binDir/"runtime.js"; 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); fs::copy(runtimePath, runtimeDstPath);
} }
} }