| 398 | // generic_path ---------------------------------------------------------------------// |
| 399 | |
| 400 | BOOST_FILESYSTEM_DECL path path_algorithms::generic_path_v3(path const& p) |
| 401 | { |
| 402 | path tmp; |
| 403 | const size_type pathname_size = p.m_pathname.size(); |
| 404 | tmp.m_pathname.reserve(pathname_size); |
| 405 | |
| 406 | const value_type* const pathname = p.m_pathname.c_str(); |
| 407 | |
| 408 | // Don't remove duplicate slashes from the root name |
| 409 | size_type root_name_size = 0u; |
| 410 | size_type root_dir_pos = find_root_directory_start(pathname, pathname_size, root_name_size); |
| 411 | if (root_name_size > 0u) |
| 412 | { |
| 413 | tmp.m_pathname.append(pathname, root_name_size); |
| 414 | #if defined(BOOST_FILESYSTEM_WINDOWS_API) |
| 415 | std::replace(tmp.m_pathname.begin(), tmp.m_pathname.end(), L'\\', L'/'); |
| 416 | #endif |
| 417 | } |
| 418 | |
| 419 | size_type pos = root_name_size; |
| 420 | if (root_dir_pos < pathname_size) |
| 421 | { |
| 422 | tmp.m_pathname.push_back(path::separator); |
| 423 | pos = root_dir_pos + 1u; |
| 424 | } |
| 425 | |
| 426 | while (pos < pathname_size) |
| 427 | { |
| 428 | size_type element_size = find_separator(pathname + pos, pathname_size - pos); |
| 429 | if (element_size > 0u) |
| 430 | { |
| 431 | tmp.m_pathname.append(pathname + pos, element_size); |
| 432 | |
| 433 | pos += element_size; |
| 434 | if (pos >= pathname_size) |
| 435 | break; |
| 436 | |
| 437 | tmp.m_pathname.push_back(path::separator); |
| 438 | } |
| 439 | |
| 440 | ++pos; |
| 441 | } |
| 442 | |
| 443 | return tmp; |
| 444 | } |
| 445 | |
| 446 | BOOST_FILESYSTEM_DECL path path_algorithms::generic_path_v4(path const& p) |
| 447 | { |
nothing calls this directly
no test coverage detected