File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -1341,7 +1341,28 @@ public:
1341
1341
}
1342
1342
1343
1343
_LIBCPP_INLINE_VISIBILITY bool is_absolute () const {
1344
+ #if defined(_LIBCPP_WIN32API)
1345
+ __string_view __root_name_str = __root_name ();
1346
+ __string_view __root_dir = __root_directory ();
1347
+ if (__root_name_str.size () == 2 && __root_name_str[1 ] == ' :' ) {
1348
+ // A drive letter with no root directory is relative, e.g. x:example.
1349
+ return !__root_dir.empty ();
1350
+ }
1351
+ // If no root name, it's relative, e.g. \example is relative to the current drive
1352
+ if (__root_name_str.empty ())
1353
+ return false ;
1354
+ if (__root_name_str.size () < 3 )
1355
+ return false ;
1356
+ // A server root name, like \\server, is always absolute
1357
+ if (__root_name_str[0 ] != ' /' && __root_name_str[0 ] != ' \\ ' )
1358
+ return false ;
1359
+ if (__root_name_str[1 ] != ' /' && __root_name_str[1 ] != ' \\ ' )
1360
+ return false ;
1361
+ // Seems to be a server root name
1362
+ return true ;
1363
+ #else
1344
1364
return has_root_directory ();
1365
+ #endif
1345
1366
}
1346
1367
_LIBCPP_INLINE_VISIBILITY bool is_relative () const { return !is_absolute (); }
1347
1368
You can’t perform that action at this time.
0 commit comments