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

Function pathFromConsoleString

Rapfi/core/utils.cpp:281–307  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

279// -------------------------------------------------
280
281std::filesystem::path pathFromConsoleString(const std::string &path)
282{
283#if defined(_WIN32)
284 // Use windows string conversion api due to mingw64 limitations.
285 int nCodePage = GetConsoleCP();
286 int convertResult =
287 MultiByteToWideChar(nCodePage, 0, path.c_str(), (int)path.length(), nullptr, 0);
288
289 if (convertResult > 0) {
290 std::wstring widePath;
291 widePath.resize(convertResult + 1);
292 convertResult = MultiByteToWideChar(nCodePage,
293 0,
294 path.c_str(),
295 (int)path.length(),
296 widePath.data(),
297 (int)widePath.size());
298
299 if (convertResult > 0)
300 return widePath;
301 }
302
303 return {};
304#else
305 return path;
306#endif
307}
308
309std::string pathToConsoleString(const std::filesystem::path &path)
310{

Callers 5

createDBStorageFunction · 0.85
readPathFromInputFunction · 0.85
makeFileListFromPathListFunction · 0.85
ensureDirFunction · 0.85

Calls 2

resizeMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected