Commit c3870312 authored by Denis Krjuchkov's avatar Denis Krjuchkov

fs/Traits.hxx: add FindLastSeparator function to PathTraitsXXX

parent 403bd77e
......@@ -56,6 +56,19 @@ struct PathTraitsFS {
}
gcc_pure gcc_nonnull_all
static const_pointer FindLastSeparator(const_pointer p) {
assert(p != nullptr);
#ifdef WIN32
const_pointer pos = p + GetLength(p);
while (p != pos && !IsSeparator(*pos))
--pos;
return IsSeparator(*pos) ? pos : nullptr;
#else
return strrchr(p, SEPARATOR);
#endif
}
gcc_pure gcc_nonnull_all
static bool IsAbsolute(const_pointer p) {
assert(p != nullptr);
#ifdef WIN32
......@@ -97,6 +110,12 @@ struct PathTraitsUTF8 {
}
gcc_pure gcc_nonnull_all
static const_pointer FindLastSeparator(const_pointer p) {
assert(p != nullptr);
return strrchr(p, SEPARATOR);
}
gcc_pure gcc_nonnull_all
static bool IsAbsolute(const_pointer p) {
assert(p != nullptr);
#ifdef WIN32
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment