19template<
class _Traits,
class _Ax>
20static BOOL
PathCanonicalizeA(_Inout_ std::basic_string<char, _Traits, _Ax> &sValue, _In_ LPCSTR pszPath)
22 char szBuffer[MAX_PATH + 1];
24 sValue.assign(szBuffer, bResult ? MAX_PATH : 0);
33template<
class _Traits,
class _Ax>
34static BOOL
PathCanonicalizeW(_Inout_ std::basic_string<wchar_t, _Traits, _Ax> &sValue, _In_ LPCWSTR pszPath)
36 wchar_t szBuffer[MAX_PATH + 1];
38 sValue.assign(szBuffer, bResult ? MAX_PATH : 0);
43template<
class _Traits,
class _Ax>
46 char szBuffer[MAX_PATH + 1];
47 size_t len = sValue.length();
48 if (len < _countof(szBuffer)) {
49 memcpy(szBuffer, sValue.c_str(), len);
52 sValue.assign(szBuffer);
55 std::unique_ptr<char[]> buf(
new char[len + 1]);
56 memcpy(buf.get(), sValue.c_str(), len);
59 sValue.assign(buf.get());
68template<
class _Traits,
class _Ax>
71 wchar_t szBuffer[MAX_PATH + 1];
72 size_t len = sValue.length();
73 if (len < _countof(szBuffer)) {
74 wmemcpy(szBuffer, sValue.c_str(), len);
77 sValue.assign(szBuffer);
80 std::unique_ptr<wchar_t[]> buf(
new wchar_t[len + 1]);
81 wmemcpy(buf.get(), sValue.c_str(), len);
84 sValue.assign(buf.get());
static BOOL PathCanonicalizeW(std::basic_string< wchar_t, _Traits, _Ax > &sValue, LPCWSTR pszPath)
Simplifies a path by removing navigation elements such as "." and ".." to produce a direct,...
Definition Shell.h:34
static void PathRemoveBackslashW(std::basic_string< wchar_t, _Traits, _Ax > &sValue)
Removes the trailing backslash from a given path.
Definition Shell.h:69
static void PathRemoveBackslashA(std::basic_string< char, _Traits, _Ax > &sValue)
Removes the trailing backslash from a given path.
Definition Shell.h:44
static BOOL PathCanonicalizeA(std::basic_string< char, _Traits, _Ax > &sValue, LPCSTR pszPath)
Simplifies a path by removing navigation elements such as "." and ".." to produce a direct,...
Definition Shell.h:20