diff options
Diffstat (limited to 'src/lib/util/corefile.cpp')
-rw-r--r-- | src/lib/util/corefile.cpp | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/lib/util/corefile.cpp b/src/lib/util/corefile.cpp index 78a484c5511..264d80f4113 100644 --- a/src/lib/util/corefile.cpp +++ b/src/lib/util/corefile.cpp @@ -23,10 +23,9 @@ #include <ctype.h> -namespace util { +namespace util { namespace { - /*************************************************************************** VALIDATION ***************************************************************************/ @@ -337,6 +336,23 @@ private: /*************************************************************************** + INLINE FUNCTIONS +***************************************************************************/ + +/*------------------------------------------------- + is_directory_separator - is a given character + a directory separator? The following logic + works for most platforms +-------------------------------------------------*/ + +inline int is_directory_separator(char c) +{ + return (c == '\\' || c == '/' || c == ':'); +} + + + +/*************************************************************************** core_text_file ***************************************************************************/ @@ -1259,7 +1275,7 @@ core_file::core_file() std::string core_filename_extract_base(const std::string &name, bool strip_extension) { // find the start of the basename - auto const start = std::find_if(name.rbegin(), name.rend(), &util::is_directory_separator); + auto const start = std::find_if(name.rbegin(), name.rend(), [](char c) { return util::is_directory_separator(c); }); // find the end of the basename auto const chop_position = strip_extension |