Returns the long path of the specified file. @param p_File File path. @return Long path.
| 60 | // @return Long path. |
| 61 | // |
| 62 | std::wstring LongPathPlugin::GetPath(const std::wstring& p_File) const |
| 63 | { |
| 64 | assert(m_pSettings != nullptr); |
| 65 | |
| 66 | std::wstring path(p_File); |
| 67 | if (!path.empty()) { |
| 68 | const auto bufferSize = ::GetLongPathNameW(p_File.c_str(), nullptr, 0); |
| 69 | if (bufferSize != 0) { |
| 70 | std::wstring longPath(bufferSize, L'\0'); |
| 71 | if (::GetLongPathNameW(p_File.c_str(), &*longPath.begin(), gsl::narrow<DWORD>(longPath.size())) != 0) { |
| 72 | path = longPath.c_str(); |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | // Append separator if needed. |
| 77 | if (m_pSettings != nullptr && m_pSettings->GetAppendSeparatorForDirectories() && PluginUtils::IsDirectory(path)) { |
| 78 | path += L"\\"; |
| 79 | } |
| 80 | } |
| 81 | return path; |
| 82 | } |
| 83 | |
| 84 | // |
| 85 | // Protected constructor with custom description and help text resources. |
nothing calls this directly
no test coverage detected