forked from cory/tildefriends
httpd: Move starting the http server into C.
This commit is contained in:
@ -212,14 +212,7 @@ static JSValue _file_read_file(JSContext* context, JSValueConst this_val, int ar
|
||||
{
|
||||
tf_task_t* task = JS_GetContextOpaque(context);
|
||||
const char* file_name = JS_ToCString(context, argv[0]);
|
||||
const char* actual = file_name;
|
||||
if (tf_task_get_root_path(task))
|
||||
{
|
||||
size_t size = strlen(tf_task_get_root_path(task)) + strlen(file_name) + 2;
|
||||
char* buffer = alloca(size);
|
||||
snprintf(buffer, size, "%s/%s", tf_task_get_root_path(task), file_name);
|
||||
actual = buffer;
|
||||
}
|
||||
const char* actual = tf_task_get_path_with_root(task, file_name);
|
||||
|
||||
promiseid_t promise = -1;
|
||||
JSValue promise_value = tf_task_allocate_promise(task, &promise);
|
||||
@ -241,6 +234,7 @@ static JSValue _file_read_file(JSContext* context, JSValueConst this_val, int ar
|
||||
tf_free(req);
|
||||
}
|
||||
JS_FreeCString(context, file_name);
|
||||
tf_free((char*)actual);
|
||||
return promise_value;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user