aboutsummaryrefslogtreecommitdiff
path: root/src/path.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2023-01-20 13:01:00 +0000
committergingerBill <bill@gingerbill.org>2023-01-20 13:01:00 +0000
commitc949e404c38355daea2fcea0faa161e0a14e20b4 (patch)
tree226f31f1316f030a6736741ff4ebb828da5fc8ea /src/path.cpp
parent3d2a6c5895793c2a1b5c2b7e0d5ae67a20908c8d (diff)
Fix bug when `.` is passed to `remove_extension_from_path`
Diffstat (limited to 'src/path.cpp')
-rw-r--r--src/path.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/path.cpp b/src/path.cpp
index 3b359a269..49a2d4a4f 100644
--- a/src/path.cpp
+++ b/src/path.cpp
@@ -2,6 +2,9 @@
Path handling utilities.
*/
gb_internal String remove_extension_from_path(String const &s) {
+ if (s.len != 0 && s.text[s.len-1] == '.') {
+ return s;
+ }
for (isize i = s.len-1; i >= 0; i--) {
if (s[i] == '.') {
return substring(s, 0, i);