relative file comments
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Thu, 13 May 2021 20:38:26 +0000 (15:38 -0500)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Thu, 13 May 2021 20:38:26 +0000 (15:38 -0500)
src/onyx.c
src/onyxwasm.c

index ec2396b4f2c74e3766e14c9c98a1ee4fca607af6..ce3c4b06de8f97830ab1ba7c29ecd3334ac76c4c 100644 (file)
@@ -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;
index c0cf375814ab5c210220382b880e69338120cf42..4ae3a6fb75371489b040d80eda7809cf720254c0 100644 (file)
@@ -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;