aboutsummaryrefslogtreecommitdiff
path: root/src/string.cpp
diff options
context:
space:
mode:
authorChris Heyes <rumcode@icloud.com>2018-10-16 23:56:19 +0100
committerChris Heyes <rumcode@icloud.com>2018-10-16 23:56:19 +0100
commitae02e9c34aa08b642fd6ca5465f988f8f1d98c60 (patch)
tree18f5437c91861d5610c023641612449dd31c19a1 /src/string.cpp
parent139fa55c279ed7a244be26d9103ba3b37a2b88b6 (diff)
Use name of source file as output_name
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 80a7180a2..7ceeb78a1 100644
--- a/src/string.cpp
+++ b/src/string.cpp
@@ -276,6 +276,15 @@ String filename_from_path(String s) {
return make_string(nullptr, 0);
}
+String remove_extension_from_path(String const &s) {
+ for (isize i = s.len-1; i >= 0; i--) {
+ if (s[i] == '.') {
+ return substring(s, 0, i);
+ }
+ }
+ return s;
+}
+
String remove_directory_from_path(String const &s) {
isize len = 0;
for (isize i = s.len-1; i >= 0; i--) {
@@ -287,6 +296,7 @@ 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--) {