| 138 | #endif |
| 139 | |
| 140 | std::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 |
no test coverage detected