@brief Converts wstring to string using Windows specific function @param wstr Wide string to convert @return A converted utf8 string
| 46 | /// @param wstr Wide string to convert |
| 47 | /// @return A converted utf8 string |
| 48 | inline std::string wstr_to_str(const std::wstring &wstr) |
| 49 | { |
| 50 | if (wstr.empty()) |
| 51 | { |
| 52 | return {}; |
| 53 | } |
| 54 | |
| 55 | auto wstr_len = static_cast<int>(wstr.size()); |
| 56 | auto str_len = WideCharToMultiByte(CP_UTF8, 0, &wstr[0], wstr_len, NULL, 0, NULL, NULL); |
| 57 | |
| 58 | std::string str(str_len, 0); |
| 59 | WideCharToMultiByte(CP_UTF8, 0, &wstr[0], wstr_len, &str[0], str_len, NULL, NULL); |
| 60 | |
| 61 | return str; |
| 62 | } |
| 63 | |
| 64 | inline std::vector<std::string> get_args() |
| 65 | { |