aboutsummaryrefslogtreecommitdiffstats
path: root/src/fs/Traits.hxx
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/fs/Traits.hxx18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/fs/Traits.hxx b/src/fs/Traits.hxx
index ff7978b6b..927496e53 100644
--- a/src/fs/Traits.hxx
+++ b/src/fs/Traits.hxx
@@ -68,11 +68,18 @@ struct PathTraitsFS {
#endif
}
+#ifdef WIN32
+ gcc_pure gcc_nonnull_all
+ static constexpr bool IsDrive(const_pointer p) {
+ return IsAlphaASCII(p[0]) && p[1] == ':';
+ }
+#endif
+
gcc_pure gcc_nonnull_all
static bool IsAbsolute(const_pointer p) {
assert(p != nullptr);
#ifdef WIN32
- if (IsAlphaASCII(p[0]) && p[1] == ':' && IsSeparator(p[2]))
+ if (IsDrive(p) && IsSeparator(p[2]))
return true;
#endif
return IsSeparator(*p);
@@ -135,11 +142,18 @@ struct PathTraitsUTF8 {
return strrchr(p, SEPARATOR);
}
+#ifdef WIN32
+ gcc_pure gcc_nonnull_all
+ static constexpr bool IsDrive(const_pointer p) {
+ return IsAlphaASCII(p[0]) && p[1] == ':';
+ }
+#endif
+
gcc_pure gcc_nonnull_all
static bool IsAbsolute(const_pointer p) {
assert(p != nullptr);
#ifdef WIN32
- if (IsAlphaASCII(p[0]) && p[1] == ':' && IsSeparator(p[2]))
+ if (IsDrive(p) && IsSeparator(p[2]))
return true;
#endif
return IsSeparator(*p);