diff options
| author | gingerBill <bill@gingerbill.org> | 2018-05-27 11:40:27 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2018-05-27 11:40:27 +0100 |
| commit | df578d6ec58e678e30b90601550f82ac4153b3e8 (patch) | |
| tree | 086e3f1982b7e2ead03c4e2c47fa9343c768fcfd /src/string.cpp | |
| parent | 6aae381e83dddf8808feefe4a5a2470320f27342 (diff) | |
Allow for either .odin file or directory as the initial start
Diffstat (limited to 'src/string.cpp')
| -rw-r--r-- | src/string.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/string.cpp b/src/string.cpp index 32d97184a..96e17f58f 100644 --- a/src/string.cpp +++ b/src/string.cpp @@ -287,6 +287,16 @@ String remove_directory_from_path(String const &s) { } return substring(s, s.len-len, s.len); } +String directory_from_path(String const &s) { + isize i = s.len-1; + for (; i >= 0; i--) { + if (s[i] == '/' || + s[i] == '\\') { + break; + } + } + return substring(s, 0, i); +} String concatenate_strings(gbAllocator a, String const &x, String const &y) { |