MCPcopy Create free account
hub / github.com/dhbloo/rapfi / pathToConsoleString

Function pathToConsoleString

Rapfi/core/utils.cpp:309–345  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

307}
308
309std::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
347std::vector<std::string> listAllFilesInDirRecursively(const std::string &dirpath,
348 const std::vector<std::string> &extensions)

Callers 13

readDatabaseMethod · 0.85
YXDBStorageMethod · 0.85
flushMethod · 0.85
loadMethod · 0.85
dumpHashFunction · 0.85
loadHashFunction · 0.85
databaseToTxtFunction · 0.85
libToDatabaseFunction · 0.85
EvaluatorMethod · 0.85
loadMethod · 0.85
OnnxEvaluatorMethod · 0.85

Calls 2

resizeMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected