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

Method GetPath

PathCopyCopy/plugins/src/ShortUNCPathPlugin.cpp:60–76  ·  view source on GitHub ↗

Returns the short UNC path of the specified file. @param p_File File path. @return Short UNC path.

Source from the content-addressed store, hash-verified

58 // @return Short UNC path.
59 //
60 std::wstring ShortUNCPathPlugin::GetPath(const std::wstring& p_File) const
61 {
62 // First call inherited to get a long path.
63 std::wstring path = LongUNCPathPlugin::GetPath(p_File);
64
65 // Now ask for a short version and return it.
66 if (!path.empty()) {
67 const auto bufferSize = ::GetShortPathNameW(path.c_str(), nullptr, 0);
68 if (bufferSize != 0) {
69 std::wstring shortPath(bufferSize, L'\0');
70 if (::GetShortPathNameW(path.c_str(), &*shortPath.begin(), gsl::narrow<DWORD>(shortPath.size())) != 0) {
71 path = shortPath.c_str();
72 }
73 }
74 }
75 return path;
76 }
77
78 //
79 // Determines if this plugin is androgynous. It is considered androgynous

Callers

nothing calls this directly

Calls 3

emptyMethod · 0.80
beginMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected