Path: blob/main/contrib/llvm-project/libcxx/src/filesystem/filesystem_error.cpp
35231 views
//===----------------------------------------------------------------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#include <__config>9#include <__utility/unreachable.h>10#include <filesystem>11#include <system_error>1213#include "format_string.h"1415_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM1617filesystem_error::~filesystem_error() {}1819void filesystem_error::__create_what(int __num_paths) {20const char* derived_what = system_error::what();21__storage_->__what_ = [&]() -> string {22switch (__num_paths) {23case 0:24return detail::format_string("filesystem error: %s", derived_what);25case 1:26return detail::format_string("filesystem error: %s [" PATH_CSTR_FMT "]", derived_what, path1().c_str());27case 2:28return detail::format_string(29"filesystem error: %s [" PATH_CSTR_FMT "] [" PATH_CSTR_FMT "]",30derived_what,31path1().c_str(),32path2().c_str());33}34__libcpp_unreachable();35}();36}3738_LIBCPP_END_NAMESPACE_FILESYSTEM394041