aboutsummaryrefslogtreecommitdiff
path: root/src/Utils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Utils.cpp')
-rw-r--r--src/Utils.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/Utils.cpp b/src/Utils.cpp
index bc7b1f2..f23a330 100644
--- a/src/Utils.cpp
+++ b/src/Utils.cpp
@@ -27,6 +27,11 @@ namespace gsr {
return str.size() >= len && memcmp(str.data(), substr, len) == 0;
}
+ bool ends_with(std::string_view str, const char *substr) {
+ size_t len = strlen(substr);
+ return str.size() >= len && memcmp(str.data() + str.size() - len, substr, len) == 0;
+ }
+
std::string get_home_dir() {
const char *home_dir = getenv("HOME");
if(!home_dir) {