aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/libs/dutil/WixToolset.DUtil/pathutil.cpp6
-rw-r--r--src/libs/dutil/test/DUtilUnitTest/PathUtilTest.cpp33
2 files changed, 33 insertions, 6 deletions
diff --git a/src/libs/dutil/WixToolset.DUtil/pathutil.cpp b/src/libs/dutil/WixToolset.DUtil/pathutil.cpp
index fa07f165..9823779b 100644
--- a/src/libs/dutil/WixToolset.DUtil/pathutil.cpp
+++ b/src/libs/dutil/WixToolset.DUtil/pathutil.cpp
@@ -100,12 +100,6 @@ DAPI_(HRESULT) PathGetDirectory(
100 return S_FALSE; 100 return S_FALSE;
101 } 101 }
102 102
103 if (wzPath[0] == L'\"')
104 {
105 ++wzPath;
106 --cchDirectory;
107 }
108
109 hr = StrAllocString(psczDirectory, wzPath, cchDirectory); 103 hr = StrAllocString(psczDirectory, wzPath, cchDirectory);
110 PathExitOnFailure(hr, "Failed to copy directory."); 104 PathExitOnFailure(hr, "Failed to copy directory.");
111 105
diff --git a/src/libs/dutil/test/DUtilUnitTest/PathUtilTest.cpp b/src/libs/dutil/test/DUtilUnitTest/PathUtilTest.cpp
index 5a1f06fd..6a05a45c 100644
--- a/src/libs/dutil/test/DUtilUnitTest/PathUtilTest.cpp
+++ b/src/libs/dutil/test/DUtilUnitTest/PathUtilTest.cpp
@@ -12,6 +12,39 @@ namespace DutilTests
12 { 12 {
13 public: 13 public:
14 [Fact] 14 [Fact]
15 void PathGetDirectoryTest()
16 {
17 HRESULT hr = S_OK;
18 LPWSTR sczPath = NULL;
19 LPCWSTR rgwzPaths[18] =
20 {
21 L"C:\\a\\b", L"C:\\a\\",
22 L"C:\\a", L"C:\\",
23 L"C:\\", L"C:\\",
24 L"\"C:\\a\\b\\c\"", L"\"C:\\a\\b\\",
25 L"\"C:\\a\\b\\\"c", L"\"C:\\a\\b\\",
26 L"\"C:\\a\\b\"\\c", L"\"C:\\a\\b\"\\",
27 L"\"C:\\a\\\"b\\c", L"\"C:\\a\\\"b\\",
28 L"C:\\a\"\\\"b\\c", L"C:\\a\"\\\"b\\",
29 L"C:\\a\"\\b\\c\"", L"C:\\a\"\\b\\",
30 };
31
32 try
33 {
34 for (DWORD i = 0; i < countof(rgwzPaths); i += 2)
35 {
36 hr = PathGetDirectory(rgwzPaths[i], &sczPath);
37 NativeAssert::Succeeded(hr, "PathGetDirectory: {0}", rgwzPaths[i]);
38 NativeAssert::StringEqual(rgwzPaths[i + 1], sczPath);
39 }
40 }
41 finally
42 {
43 ReleaseStr(sczPath);
44 }
45 }
46
47 [Fact]
15 void PathGetHierarchyArrayTest() 48 void PathGetHierarchyArrayTest()
16 { 49 {
17 HRESULT hr = S_OK; 50 HRESULT hr = S_OK;