aboutsummaryrefslogtreecommitdiff
path: root/src/string.cpp
diff options
context:
space:
mode:
authorJeroen van Rijn <Kelimion@users.noreply.github.com>2022-04-24 19:53:36 +0200
committerJeroen van Rijn <Kelimion@users.noreply.github.com>2022-04-24 19:53:36 +0200
commit63331ef731209ec8db65d7f26bdbebdf9459107d (patch)
tree5821f52c432a07d374fddc4b89d8a466833b3734 /src/string.cpp
parenta40a53b10447c9223c24cccf565a95f1773d3922 (diff)
Revert "Merge pull request #1702 from Kelimion/filename_generation"
This reverts commit a40a53b10447c9223c24cccf565a95f1773d3922, reversing changes made to 5422a3b17eae821df4adf869960995e922eb0e76.
Diffstat (limited to 'src/string.cpp')
-rw-r--r--src/string.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/string.cpp b/src/string.cpp
index 3515df48e..d3dbc6904 100644
--- a/src/string.cpp
+++ b/src/string.cpp
@@ -245,14 +245,15 @@ gb_inline isize string_extension_position(String const &str) {
return dot_pos;
}
-String path_extension(String const &str, bool include_dot = true) {
+String path_extension(String const &str) {
isize pos = string_extension_position(str);
if (pos < 0) {
return make_string(nullptr, 0);
}
- return substring(str, include_dot ? pos : pos + 1, str.len);
+ return substring(str, pos, str.len);
}
+
String string_trim_whitespace(String str) {
while (str.len > 0 && rune_is_whitespace(str[str.len-1])) {
str.len--;
@@ -327,10 +328,7 @@ String directory_from_path(String const &s) {
break;
}
}
- if (i >= 0) {
- return substring(s, 0, i);
- }
- return substring(s, 0, 0);
+ return substring(s, 0, i);
}
String concatenate_strings(gbAllocator a, String const &x, String const &y) {