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