Fix cache, misc changes

This commit is contained in:
Krzosa Karol
2024-01-13 21:18:08 +01:00
parent 1b6d908b6b
commit c375cdf04f
12 changed files with 28 additions and 26 deletions

View File

@@ -3,12 +3,8 @@
leeway for big buffers and other such things. Just make sure to not relay on it because it's easier unless specified.
- Not sure if we should assume that strings should use allocators or arenas, for now it's arenas because I don't have other use cases
@todo
- Maybe create a nice C++ binding for strings,
- Add proper string arrays and utilities for build files
- also add String Arrays and String Builder, temp allocators hook ins for nicer api
- Iterating over unicode codepoints using For
- Redesign clexer because the Arena Tuple is hella weird
- Maybe remove token array stuff, do standard stream thing, then you need one arena ...
- Add filter stuff so we can get includes / comments / normal tokens etc.
*/
#include "core.h"

View File

@@ -495,10 +495,11 @@ OS_API void OS_Advance(OS_FileIter *it) {
it->is_directory = file->d_type == DT_DIR;
it->filename = S8_CopyChar(it->arena, file->d_name);
const char *is_dir = it->is_directory ? "/" : "";
const char *dir_char_ending = it->is_directory ? "/" : "";
const char *separator = it->path.str[it->path.len - 1] == '/' ? "" : "/";
it->relative_path = S8_Format(it->arena, "%.*s%s%s%s", S8_Expand(it->path), separator, file->d_name, is_dir);
it->relative_path = S8_Format(it->arena, "%.*s%s%s%s", S8_Expand(it->path), separator, file->d_name, dir_char_ending);
it->absolute_path = OS_GetAbsolutePath(it->arena, it->relative_path);
if (it->is_directory) it->absolute_path = S8_Format(it->arena, "%.*s/", S8_Expand(it->absolute_path));
it->is_valid = true;
return;
}