4#include "Stroika/Foundation/StroikaPreComp.h"
13using namespace Stroika::Foundation::IO;
24Characters::String FileSystem::Exception::mkMsg_ (error_code errCode,
const path& p1,
const path& p2)
26 StringBuilder sb = Execution::Private_::SystemErrorExceptionPrivate_::mkMsg_ (errCode);
27 if (not p1.empty ()) {
28 sb <<
" {"sv <<
String{p1.wstring ()}.
LimitLength (25, StringShorteningPreference::ePreferKeepRight) <<
"}"sv;
30 if (not p2.empty ()) {
31 sb <<
" {"sv <<
String{p2.wstring ()}.
LimitLength (25, StringShorteningPreference::ePreferKeepRight) <<
"}"sv;
38 StringBuilder sb = Execution::Private_::SystemErrorExceptionPrivate_::mkCombinedMsg_ (errCode, message);
39 if (not p1.empty ()) {
40 sb <<
" {"sv <<
String{p1.wstring ()}.
LimitLength (25, StringShorteningPreference::ePreferKeepRight) <<
"}"sv;
42 if (not p2.empty ()) {
43 sb <<
" {"sv <<
String{p2.wstring ()}.
LimitLength (25, StringShorteningPreference::ePreferKeepRight) <<
"}"sv;
50#if USE_NOISY_TRACE_IN_THIS_MODULE_
54#if qStroika_Foundation_Common_Platform_POSIX
55 error_code ec{errNo, system_category ()};
57 error_code ec{errNo, generic_category ()};
64#if USE_NOISY_TRACE_IN_THIS_MODULE_
65 Debug::TraceContextBumper ctx{
"IO::FileSystem::Exception::ThrowSystemErrNo",
"sysErr={}, p1={}, p2={}"_f, sysErr, p1, p2};
67 Require (sysErr != 0);
68 error_code ec{sysErr, system_category ()};
74#if qStroika_Foundation_Common_Platform_POSIX
75 ThrowSystemErrNo (errno, p1, p2);
76#elif qStroika_Foundation_Common_Platform_Windows
77 ThrowSystemErrNo (::GetLastError (), p1, p2);
Similar to String, but intended to more efficiently construct a String. Mutable type (String is large...
String is like std::u32string, except it is much easier to use, often much more space efficient,...
nonvirtual String LimitLength(size_t maxLen, StringShorteningPreference keepPref=StringShorteningPreference::ePreferKeepLeft) const
return the first maxLen (or fewer if string shorter) characters of this string (adding ellipsis if tr...
static void ThrowPOSIXErrNo(errno_t errNo, const path &p1={}, const path &p2={})
treats errNo as a POSIX errno value, and throws a FileSystem::Exception (subclass of @std::filesystem...
static void ThrowSystemErrNo(int sysErr, const path &p1={}, const path &p2={})
treats errNo as a platform-defined error number, and throws a FileSystem::Exception (subclass of @std...