MCPcopy Create free account
hub / github.com/ElementsProject/elements / get_filesystem_error_message

Function get_filesystem_error_message

src/fs.cpp:140–154  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

138#endif
139
140std::string get_filesystem_error_message(const fs::filesystem_error& e)
141{
142#ifndef WIN32
143 return e.what();
144#else
145 // Convert from Multi Byte to utf-16
146 std::string mb_string(e.what());
147 int size = MultiByteToWideChar(CP_ACP, 0, mb_string.data(), mb_string.size(), nullptr, 0);
148
149 std::wstring utf16_string(size, L'\0');
150 MultiByteToWideChar(CP_ACP, 0, mb_string.data(), mb_string.size(), &*utf16_string.begin(), size);
151 // Convert from utf-16 to utf-8
152 return std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>, wchar_t>().to_bytes(utf16_string);
153#endif
154}
155
156} // fsbridge

Callers 4

ShutdownFunction · 0.85
BackupMethod · 0.85
MakeDatabaseFunction · 0.85
DeleteAuthCookieFunction · 0.85

Calls 3

dataMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected