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

Method GetPath

PathCopyCopy/plugins/src/LongPathPlugin.cpp:62–82  ·  view source on GitHub ↗

Returns the long path of the specified file. @param p_File File path. @return Long path.

Source from the content-addressed store, hash-verified

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.

Callers

nothing calls this directly

Calls 4

emptyMethod · 0.80
beginMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected