diff options
| author | gingerBill <bill@gingerbill.org> | 2024-02-09 15:18:29 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2024-02-09 15:18:29 +0000 |
| commit | 5c4485f65767366c14dfd9a98945a5479ae0e449 (patch) | |
| tree | 94ee4b5181c381f45332b27fb37d78b5464c6bde /src/string.cpp | |
| parent | bae2a6fc1e0d2207e51a66b5ea6e8ae511a3da6a (diff) | |
Add `#load_directory(path: string) > []runtime.Load_Directory_File`
Diffstat (limited to 'src/string.cpp')
| -rw-r--r-- | src/string.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/string.cpp b/src/string.cpp index 9fb933b1b..bd703b2a6 100644 --- a/src/string.cpp +++ b/src/string.cpp @@ -293,6 +293,18 @@ gb_internal String filename_from_path(String s) { return make_string(nullptr, 0); } + +gb_internal String filename_without_directory(String s) { + isize j = 0; + for (j = s.len-1; j >= 0; j--) { + if (s[j] == '/' || + s[j] == '\\') { + break; + } + } + return substring(s, gb_max(j+1, 0), s.len); +} + gb_internal String concatenate_strings(gbAllocator a, String const &x, String const &y) { isize len = x.len+y.len; u8 *data = gb_alloc_array(a, u8, len+1); |