| 307 | } |
| 308 | |
| 309 | std::string pathToConsoleString(const std::filesystem::path &path) |
| 310 | { |
| 311 | #if defined(_WIN32) |
| 312 | std::wstring widePath = path.wstring(); |
| 313 | |
| 314 | // Use windows string conversion api due to mingw64 limitations. |
| 315 | int nCodePage = GetConsoleOutputCP(); |
| 316 | int convertResult = WideCharToMultiByte(nCodePage, |
| 317 | 0, |
| 318 | widePath.c_str(), |
| 319 | (int)widePath.length(), |
| 320 | nullptr, |
| 321 | 0, |
| 322 | 0, |
| 323 | 0); |
| 324 | |
| 325 | if (convertResult > 0) { |
| 326 | std::string narrowPath; |
| 327 | narrowPath.resize(convertResult + 1); |
| 328 | convertResult = WideCharToMultiByte(nCodePage, |
| 329 | 0, |
| 330 | widePath.c_str(), |
| 331 | (int)widePath.length(), |
| 332 | narrowPath.data(), |
| 333 | (int)narrowPath.size(), |
| 334 | 0, |
| 335 | 0); |
| 336 | |
| 337 | if (convertResult > 0) |
| 338 | return narrowPath.c_str(); |
| 339 | } |
| 340 | |
| 341 | return {}; |
| 342 | #else |
| 343 | return path.string(); |
| 344 | #endif |
| 345 | } |
| 346 | |
| 347 | std::vector<std::string> listAllFilesInDirRecursively(const std::string &dirpath, |
| 348 | const std::vector<std::string> &extensions) |
no test coverage detected