diff options
Diffstat (limited to 'src/stringutils.cpp')
-rw-r--r-- | src/stringutils.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/stringutils.cpp b/src/stringutils.cpp index d750165..1f5ff47 100644 --- a/src/stringutils.cpp +++ b/src/stringutils.cpp @@ -31,6 +31,8 @@ #include <list> #include <regex> +#include <sys/stat.h> + std::string &trim(std::string &str) { size_t pos = str.find_last_not_of(' '); @@ -711,3 +713,11 @@ bool isMatch(const std::string &str, const std::string &exp) std::regex regExp(exp); return std::regex_match(str, regExp); } + +bool fileExists(const std::string &name) +{ + struct stat statbuf; + if (stat(name.c_str(), &statbuf)) + return false; + return true; +} |