Load is file relative not module relative

This commit is contained in:
Krzosa Karol
2022-10-09 15:20:53 +02:00
parent 54426fdd69
commit 9ad2da03c8
8 changed files with 16 additions and 21 deletions

View File

@@ -742,8 +742,9 @@ register_ast_file(Token *pos, String absolute_file_path, Ast_Module *module, B32
if(!file){
log_trace("%Q :: Registering file: %Q\n", module->absolute_file_path, absolute_file_path);
AST_NEW(File, FILE, 0, 0);
file = result;
file->absolute_file_path = absolute_file_path;
file = result;
file->absolute_file_path = absolute_file_path;
file->absolute_base_folder = string_copy(pctx->perm, string_chop_last_slash(file->absolute_file_path));
file->module = module;
file->parent_scope = 0;
file->file = file; // @warning: self referential!
@@ -777,7 +778,7 @@ function Ast_File *
parse_load(B32 global_implicit_load){
Token *file = token_expect(TK_StringLit);
Intern_String filename = preprocess_filename(file);
String absolute_path = string_fmt(pctx->perm, "%Q/%Q", pctx->currently_parsed_file->module->absolute_base_folder, filename);
String absolute_path = string_fmt(pctx->perm, "%Q/%Q", pctx->currently_parsed_file->absolute_base_folder, filename);
Ast_File *result = register_ast_file(file, absolute_path, pctx->currently_parsed_file->module, global_implicit_load);
return result;
}