MCPcopy Create free account
hub / github.com/clechasseur/pathcopycopy / GetPath

Method GetPath

PathCopyCopy/plugins/src/MSYSPathPlugin.cpp:65–86  ·  view source on GitHub ↗

Returns the MSYS/MSYS2 path of the specified file. @param p_File File path. @return File path in MSYS/MSYS2 format (/c/...)

Source from the content-addressed store, hash-verified

63 // @return File path in MSYS/MSYS2 format (/c/...)
64 //
65 std::wstring MSYSPathPlugin::GetPath(const std::wstring& p_File) const
66 {
67 // Call parent to get Unix path.
68 std::wstring path = UnixPathPlugin::GetPath(p_File);
69
70 // Check if the file begins with a drive letter. If so,
71 // remove the drive letter and replace it with /letter.
72 [[gsl::suppress(type.4)]] // Compiler considers foo{bar} to be a C-style cast
73 if (path.size() >= 3 && path.at(1) == L':') {
74 std::wstringstream newPathSS;
75 newPathSS << L"/" // The prefix
76 << wchar_t{::towlower(path.front())} // Drive letter
77 << path.substr(2); // Rest of the path, including the slash after that : we had.
78 path = newPathSS.str();
79 }
80
81 // Escape spaces bash-style. This works without quotes.
82 StringUtils::ReplaceAll(path, L" ", L"\\ ");
83
84 // Return modified path.
85 return path;
86 }
87
88 } // namespace Plugins
89

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected