diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2022-05-26 17:31:36 -0500 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2022-05-31 13:20:44 -0500 |
| commit | 8b6f46af50651e0b1faf7adf94a179c6e16a05b1 (patch) | |
| tree | 5712eb6cb122255999c483942d2f2a74be818cdd /src/libs/dutil/WixToolset.DUtil/pathutil.cpp | |
| parent | 47e6ad2e072bed9f381c947b565b2f818c649121 (diff) | |
| download | wix-8b6f46af50651e0b1faf7adf94a179c6e16a05b1.tar.gz wix-8b6f46af50651e0b1faf7adf94a179c6e16a05b1.tar.bz2 wix-8b6f46af50651e0b1faf7adf94a179c6e16a05b1.zip | |
PathEnsureQuoted is not generally useful.
Diffstat (limited to 'src/libs/dutil/WixToolset.DUtil/pathutil.cpp')
| -rw-r--r-- | src/libs/dutil/WixToolset.DUtil/pathutil.cpp | 58 |
1 files changed, 0 insertions, 58 deletions
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: | |||
| 875 | } | 875 | } |
| 876 | 876 | ||
| 877 | 877 | ||
| 878 | DAPI_(HRESULT) PathEnsureQuoted( | ||
| 879 | __inout LPWSTR* ppszPath, | ||
| 880 | __in BOOL fDirectory | ||
| 881 | ) | ||
| 882 | { | ||
| 883 | Assert(ppszPath && *ppszPath); | ||
| 884 | |||
| 885 | HRESULT hr = S_OK; | ||
| 886 | size_t cchPath = 0; | ||
| 887 | |||
| 888 | hr = ::StringCchLengthW(*ppszPath, STRSAFE_MAX_CCH, &cchPath); | ||
| 889 | PathExitOnFailure(hr, "Failed to get the length of the path."); | ||
| 890 | |||
| 891 | // Handle simple special cases. | ||
| 892 | if (0 == cchPath || (1 == cchPath && L'"' == (*ppszPath)[0])) | ||
| 893 | { | ||
| 894 | hr = StrAllocString(ppszPath, L"\"\"", 2); | ||
| 895 | PathExitOnFailure(hr, "Failed to allocate a quoted empty string."); | ||
| 896 | |||
| 897 | ExitFunction(); | ||
| 898 | } | ||
| 899 | |||
| 900 | if (L'"' != (*ppszPath)[0]) | ||
| 901 | { | ||
| 902 | hr = StrAllocPrefix(ppszPath, L"\"", 1); | ||
| 903 | PathExitOnFailure(hr, "Failed to allocate an opening quote."); | ||
| 904 | |||
| 905 | // Add a char for the opening quote. | ||
| 906 | ++cchPath; | ||
| 907 | } | ||
| 908 | |||
| 909 | if (L'"' != (*ppszPath)[cchPath - 1]) | ||
| 910 | { | ||
| 911 | hr = StrAllocConcat(ppszPath, L"\"", 1); | ||
| 912 | PathExitOnFailure(hr, "Failed to allocate a closing quote."); | ||
| 913 | |||
| 914 | // Add a char for the closing quote. | ||
| 915 | ++cchPath; | ||
| 916 | } | ||
| 917 | |||
| 918 | if (fDirectory) | ||
| 919 | { | ||
| 920 | if (L'\\' != (*ppszPath)[cchPath - 2]) | ||
| 921 | { | ||
| 922 | // Change the last char to a backslash and re-append the closing quote. | ||
| 923 | (*ppszPath)[cchPath - 1] = L'\\'; | ||
| 924 | |||
| 925 | hr = StrAllocConcat(ppszPath, L"\"", 1); | ||
| 926 | PathExitOnFailure(hr, "Failed to allocate another closing quote after the backslash."); | ||
| 927 | } | ||
| 928 | } | ||
| 929 | |||
| 930 | LExit: | ||
| 931 | |||
| 932 | return hr; | ||
| 933 | } | ||
| 934 | |||
| 935 | |||
| 936 | DAPI_(HRESULT) PathCompare( | 878 | DAPI_(HRESULT) PathCompare( |
| 937 | __in_z LPCWSTR wzPath1, | 879 | __in_z LPCWSTR wzPath1, |
| 938 | __in_z LPCWSTR wzPath2, | 880 | __in_z LPCWSTR wzPath2, |
