aboutsummaryrefslogtreecommitdiff
path: root/src/string.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2018-05-27 11:40:27 +0100
committergingerBill <bill@gingerbill.org>2018-05-27 11:40:27 +0100
commitdf578d6ec58e678e30b90601550f82ac4153b3e8 (patch)
tree086e3f1982b7e2ead03c4e2c47fa9343c768fcfd /src/string.cpp
parent6aae381e83dddf8808feefe4a5a2470320f27342 (diff)
Allow for either .odin file or directory as the initial start
Diffstat (limited to 'src/string.cpp')
-rw-r--r--src/string.cpp10
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) {