From b80fceb01fc5d6cf56eddf404641667f21623988 Mon Sep 17 00:00:00 2001 From: Brendan Hansen Date: Thu, 13 May 2021 15:38:26 -0500 Subject: [PATCH] relative file comments --- src/onyx.c | 1 + src/onyxwasm.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/onyx.c b/src/onyx.c index ec2396b4..ce3c4b06 100644 --- a/src/onyx.c +++ b/src/onyx.c @@ -209,6 +209,7 @@ static void context_free() { // NOTE: This should not be called until immediately before using the return value. // This function can return a static variable which will change if this is called // another time. -brendanfh 2020/10/09 +// :RelativeFiles This should lookup for the file relative to "relative_to" static char* lookup_included_file(char* filename, char* relative_to) { static char path[256]; fori (i, 0, 256) path[i] = 0; diff --git a/src/onyxwasm.c b/src/onyxwasm.c index c0cf3758..4ae3a6fb 100644 --- a/src/onyxwasm.c +++ b/src/onyxwasm.c @@ -3104,6 +3104,10 @@ static void emit_file_contents(OnyxWasmModule* mod, AstFileContents* fc) { return; } + // :RelativeFiles This should be relative to the current directory by default; However, + // if the filename is prefixed with a './' or '.\\' then it should be relative to the + // file in which is was inclded. The loaded file info above should probably use the full + // file path in order to avoid duplicates. bh_file_contents contents = bh_file_read_contents(global_heap_allocator, fc->filename->text); u8* actual_data = bh_alloc(global_heap_allocator, contents.length + 1); u32 length = contents.length + 1; -- 2.25.1