From 8b6f46af50651e0b1faf7adf94a179c6e16a05b1 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Thu, 26 May 2022 17:31:36 -0500 Subject: PathEnsureQuoted is not generally useful. --- src/libs/dutil/WixToolset.DUtil/pathutil.cpp | 58 ---------------------------- 1 file changed, 58 deletions(-) (limited to 'src/libs/dutil/WixToolset.DUtil/pathutil.cpp') diff --git a/src/libs/dutil/WixToolset.DUtil/pathutil.cpp b/src/libs/dutil/WixToolset.DUtil/pathutil.cpp index 7bac8ac3..fa07f165 100644 --- a/src/libs/dutil/WixToolset.DUtil/pathutil.cpp +++ b/src/libs/dutil/WixToolset.DUtil/pathutil.cpp @@ -875,64 +875,6 @@ LExit: } -DAPI_(HRESULT) PathEnsureQuoted( - __inout LPWSTR* ppszPath, - __in BOOL fDirectory - ) -{ - Assert(ppszPath && *ppszPath); - - HRESULT hr = S_OK; - size_t cchPath = 0; - - hr = ::StringCchLengthW(*ppszPath, STRSAFE_MAX_CCH, &cchPath); - PathExitOnFailure(hr, "Failed to get the length of the path."); - - // Handle simple special cases. - if (0 == cchPath || (1 == cchPath && L'"' == (*ppszPath)[0])) - { - hr = StrAllocString(ppszPath, L"\"\"", 2); - PathExitOnFailure(hr, "Failed to allocate a quoted empty string."); - - ExitFunction(); - } - - if (L'"' != (*ppszPath)[0]) - { - hr = StrAllocPrefix(ppszPath, L"\"", 1); - PathExitOnFailure(hr, "Failed to allocate an opening quote."); - - // Add a char for the opening quote. - ++cchPath; - } - - if (L'"' != (*ppszPath)[cchPath - 1]) - { - hr = StrAllocConcat(ppszPath, L"\"", 1); - PathExitOnFailure(hr, "Failed to allocate a closing quote."); - - // Add a char for the closing quote. - ++cchPath; - } - - if (fDirectory) - { - if (L'\\' != (*ppszPath)[cchPath - 2]) - { - // Change the last char to a backslash and re-append the closing quote. - (*ppszPath)[cchPath - 1] = L'\\'; - - hr = StrAllocConcat(ppszPath, L"\"", 1); - PathExitOnFailure(hr, "Failed to allocate another closing quote after the backslash."); - } - } - -LExit: - - return hr; -} - - DAPI_(HRESULT) PathCompare( __in_z LPCWSTR wzPath1, __in_z LPCWSTR wzPath2, -- cgit v1.2.3-55-g6feb