Self-host highlight.js

This commit is contained in:
kamkow1
2025-06-25 23:58:47 +02:00
parent bbd23cc8ba
commit 632d731118
6 changed files with 1264 additions and 21 deletions

30
main.c
View File

@ -234,28 +234,20 @@ int cp(const char* source, const char* destination)
return result;
}
void copy_baked_resources_to_etc_dump(Baked_Resource *resource, void *udata)
{
char *etc_dump = (char *)udata;
char path[PATH_MAX];
get_baked_resource_path(resource->key, path, sizeof(path));
char dest[PATH_MAX];
snprintf(dest, sizeof(dest), "%s/%s", etc_dump, resource->key);
cp(path, dest);
}
void populate_etc_dump(char *etc_dump)
{
static char *files[] = {
"favicon.ico",
#if MY_DEBUG
"hotreload.js",
#endif
"theme.js",
"simple.css",
"me.jpg",
"tmoa-engine.jpg",
"tmoa-garbage.jpg",
};
lock_baked_resources();
for (size_t i = 0; i < sizeof(files)/sizeof(files[0]); i++) {
char path[PATH_MAX];
get_baked_resource_path(files[i], path, sizeof(path));
char dest[PATH_MAX];
snprintf(dest, sizeof(dest), "%s/%s", etc_dump, files[i]);
cp(path, dest);
}
baked_resource_each(&copy_baked_resources_to_etc_dump, etc_dump);
unlock_baked_resources();
}