| 4828 | } |
| 4829 | |
| 4830 | BOOST_FILESYSTEM_DECL |
| 4831 | path system_complete(path const& p, system::error_code* ec) |
| 4832 | { |
| 4833 | #ifdef BOOST_FILESYSTEM_POSIX_API |
| 4834 | |
| 4835 | if (p.empty() || p.is_absolute()) |
| 4836 | return p; |
| 4837 | |
| 4838 | path res(current_path()); |
| 4839 | path_algorithms::append_v4(res, p); |
| 4840 | return res; |
| 4841 | |
| 4842 | #else |
| 4843 | |
| 4844 | if (p.empty()) |
| 4845 | { |
| 4846 | if (ec) |
| 4847 | ec->clear(); |
| 4848 | return p; |
| 4849 | } |
| 4850 | |
| 4851 | BOOST_CONSTEXPR_OR_CONST std::size_t buf_size = 128u; |
| 4852 | wchar_t buf[buf_size]; |
| 4853 | wchar_t* pfn; |
| 4854 | std::size_t len = get_full_path_name(p, buf_size, buf, &pfn); |
| 4855 | |
| 4856 | if (error(len == 0 ? BOOST_ERRNO : 0, p, ec, "boost::filesystem::system_complete")) |
| 4857 | return path(); |
| 4858 | |
| 4859 | if (len < buf_size) // len does not include null termination character |
| 4860 | return path(&buf[0]); |
| 4861 | |
| 4862 | std::unique_ptr< wchar_t[] > big_buf(new wchar_t[len]); |
| 4863 | |
| 4864 | return error(get_full_path_name(p, len, big_buf.get(), &pfn) == 0 ? BOOST_ERRNO : 0, p, ec, "boost::filesystem::system_complete") ? path() : path(big_buf.get()); |
| 4865 | |
| 4866 | #endif |
| 4867 | } |
| 4868 | |
| 4869 | BOOST_FILESYSTEM_DECL |
| 4870 | path weakly_canonical_v3(path const& p, path const& base, system::error_code* ec) |