diff options
| author | DanielGavin <danielgavin5@hotmail.com> | 2021-02-13 00:13:31 +0100 |
|---|---|---|
| committer | DanielGavin <danielgavin5@hotmail.com> | 2021-02-13 00:13:31 +0100 |
| commit | b4da410a5f571d9b969dd3e37b8842f3b677cd7f (patch) | |
| tree | f07837ca35cbe7ad67136c08151c37c2584fd5f1 /src | |
| parent | e5511abce9d189eb04ebdc965c9af3f33bd2d03f (diff) | |
we now only index files with the correct windows/linux/.. postfix
Diffstat (limited to 'src')
| -rw-r--r-- | src/index/build.odin | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/index/build.odin b/src/index/build.odin index 5e817ee..6412174 100644 --- a/src/index/build.odin +++ b/src/index/build.odin @@ -23,6 +23,14 @@ symbol_collection: SymbolCollection; files: [dynamic] string; +platform_os : map [string] bool = { + "windows" = true, + "linux" = true, + "essence" = true, + "js" = true, + "freebsd" = true, +}; + walk_static_index_build :: proc(info: os.File_Info, in_err: os.Errno) -> (err: os.Errno, skip_dir: bool) { if info.is_dir { @@ -33,6 +41,24 @@ walk_static_index_build :: proc(info: os.File_Info, in_err: os.Errno) -> (err: o return 0, false; } + + last_underscore_index := strings.last_index(info.name, "_"); + last_dot_index := strings.last_index(info.name, "."); + + if last_underscore_index+1 < last_dot_index { + + name_between := info.name[last_underscore_index+1:last_dot_index]; + + if _, ok := platform_os[name_between]; ok { + + if name_between != ODIN_OS { + return 0, false; + } + + } + + } + forward, _ := filepath.to_slash(info.fullpath, context.temp_allocator); append(&files, strings.clone(forward, context.allocator)); |