diff options
| author | gingerBill <bill@gingerbill.org> | 2022-12-20 14:56:44 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2022-12-20 14:56:44 +0000 |
| commit | 44caa96d50574131e3615958eedc881e68c90905 (patch) | |
| tree | 9d4dbf6e994b204e1b90cc2bf276bc40d7368c27 /src/parser.cpp | |
| parent | eb0775ad53e9651ca01ad236dd3fe83786f0cecc (diff) | |
Set the file's filename and directory in `init_ast_file`
Diffstat (limited to 'src/parser.cpp')
| -rw-r--r-- | src/parser.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/parser.cpp b/src/parser.cpp index ad22ce5ff..436498c51 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -4768,8 +4768,10 @@ gb_internal Array<Ast *> parse_stmt_list(AstFile *f) { gb_internal ParseFileError init_ast_file(AstFile *f, String const &fullpath, TokenPos *err_pos) { GB_ASSERT(f != nullptr); - f->fullpath = string_trim_whitespace(fullpath); // Just in case - set_file_path_string(f->id, fullpath); + f->fullpath = string_trim_whitespace(fullpath); // Just in case + f->filename = remove_directory_from_path(f->fullpath); + f->directory = directory_from_path(f->fullpath); + set_file_path_string(f->id, f->fullpath); thread_safe_set_ast_file_from_id(f->id, f); if (!string_ends_with(f->fullpath, str_lit(".odin"))) { return ParseFile_WrongExtension; |