WinStd
Windows Win32 API using Standard C++
Shell.h
1/*
2 SPDX-License-Identifier: MIT
3 Copyright © 1991-2022 Amebis
4 Copyright © 2016 GÉANT
5*/
6
8
9#pragma once
10
11#include "Common.h"
12#include <Shlwapi.h>
13#include <string>
14
17
19template<class _Traits, class _Ax>
20static BOOL PathCanonicalizeA(_Inout_ std::basic_string<char, _Traits, _Ax> &sValue, _In_ LPCSTR pszPath)
21{
22 assert(0); // TODO: Test this code.
23
24 // Allocate buffer on heap and read into it.
25 char szBuffer[MAX_PATH + 1];
26 BOOL bResult = ::PathCanonicalizeA(szBuffer, pszPath);
27 sValue.assign(szBuffer, bResult ? MAX_PATH : 0);
28 return bResult;
29}
30
36template<class _Traits, class _Ax>
37static BOOL PathCanonicalizeW(_Inout_ std::basic_string<wchar_t, _Traits, _Ax> &sValue, _In_ LPCWSTR pszPath)
38{
39 assert(0); // TODO: Test this code.
40
41 wchar_t szBuffer[MAX_PATH + 1];
42 BOOL bResult = ::PathCanonicalizeW(szBuffer, pszPath);
43 sValue.assign(szBuffer, bResult ? MAX_PATH : 0);
44 return bResult;
45}
46
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:37
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