diff options
| author | Colin Davidson <colrdavidson@gmail.com> | 2024-02-26 12:17:53 -0500 |
|---|---|---|
| committer | Colin Davidson <colrdavidson@gmail.com> | 2024-02-26 12:17:53 -0500 |
| commit | deb89221812fd5306a778daf9f48f34c6d13073a (patch) | |
| tree | ee75d606d1b07aa2b8986ffbbf7f92aa1980f62d /src/string.cpp | |
| parent | f93f2dfd5cf56383e33f3eb7d2773c4646b37e2f (diff) | |
| parent | cba8cb2201cfb321dd627fb1c67a5a61267465ea (diff) | |
Merge branch 'master' into basic_egl
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); |