Better file generation
All checks were successful
/ build (push) Successful in 3s

This commit is contained in:
David Gonzalez Martin 2025-03-20 19:30:38 +01:00
parent fed7aa845e
commit 5b41b4914c
2 changed files with 5 additions and 4 deletions

View File

@ -1,8 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eu set -eu
clang generate.c -o generate -std=gnu2x -g clang generate.c -o generate -std=gnu2x -g
./generate
rm -rf public || true rm -rf public || true
mkdir public ./generate
cp -r pdf public/pdf cp -r pdf public/pdf
cp index.html public/index.html

View File

@ -1,5 +1,6 @@
#include <sys/mman.h> #include <sys/mman.h>
#include <sys/ptrace.h> #include <sys/ptrace.h>
#include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h> #include <unistd.h>
@ -365,7 +366,9 @@ fn void write_document(Writer* writer)
int main() int main()
{ {
int fd = open("index.html", O_TRUNC | O_WRONLY | O_CREAT, 0644); let(mkdir_result, mkdir("public", 0755));
assert(mkdir_result == 0);
int fd = open("public/index.html", O_TRUNC | O_WRONLY | O_CREAT, 0644);
assert(fd >= 0); assert(fd >= 0);
Writer writer = {}; Writer writer = {};
write_document(&writer); write_document(&writer);