Self-host highlight.js
This commit is contained in:
30
main.c
30
main.c
@ -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(©_baked_resources_to_etc_dump, etc_dump);
|
||||
unlock_baked_resources();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user