diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2019-11-25 17:24:30 +1000 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2019-11-25 18:06:33 +1000 |
commit | 2c73e671599f4d05bb98b38dbc79750a1cf04b45 (patch) | |
tree | 83023fc420c16c615c9e96640d29f681f073592d /src | |
parent | 9d9bb59efb71068f978dce42c95b4f0a472bb31e (diff) | |
download | wix-2c73e671599f4d05bb98b38dbc79750a1cf04b45.tar.gz wix-2c73e671599f4d05bb98b38dbc79750a1cf04b45.tar.bz2 wix-2c73e671599f4d05bb98b38dbc79750a1cf04b45.zip |
Fix test CanDecompileNestedDirSearchUnderRegSearch.
Diffstat (limited to 'src')
3 files changed, 46 insertions, 24 deletions
diff --git a/src/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs b/src/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs index 5afaace9..961e1a13 100644 --- a/src/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs +++ b/src/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs | |||
@@ -2292,6 +2292,14 @@ namespace WixToolset.Core.WindowsInstaller | |||
2292 | usedDrLocator = true; | 2292 | usedDrLocator = true; |
2293 | } | 2293 | } |
2294 | } | 2294 | } |
2295 | else if ("RegLocator" == parentLocatorRow.TableDefinition.Name) | ||
2296 | { | ||
2297 | var parentSearchElement = (Wix.IParentElement)this.core.GetIndexedElement(parentLocatorRow); | ||
2298 | |||
2299 | parentSearchElement.AddChild(searchElement); | ||
2300 | usedSearchElements[searchElement] = null; | ||
2301 | usedDrLocator = true; | ||
2302 | } | ||
2295 | } | 2303 | } |
2296 | 2304 | ||
2297 | // keep track of unused DrLocator rows | 2305 | // keep track of unused DrLocator rows |
@@ -2362,7 +2370,8 @@ namespace WixToolset.Core.WindowsInstaller | |||
2362 | } | 2370 | } |
2363 | else | 2371 | else |
2364 | { | 2372 | { |
2365 | if ("DrLocator" == locatorRow.TableDefinition.Name) | 2373 | if ("DrLocator" == locatorRow.TableDefinition.Name || |
2374 | "RegLocator" == locatorRow.TableDefinition.Name) | ||
2366 | { | 2375 | { |
2367 | unusedSearchElements.Add(searchElement); | 2376 | unusedSearchElements.Add(searchElement); |
2368 | } | 2377 | } |
@@ -2385,32 +2394,45 @@ namespace WixToolset.Core.WindowsInstaller | |||
2385 | { | 2394 | { |
2386 | var used = false; | 2395 | var used = false; |
2387 | 2396 | ||
2388 | foreach (Wix.ISchemaElement schemaElement in unusedSearchElement.Children) | 2397 | Wix.DirectorySearch leafDirectorySearch = null; |
2398 | var parentElement = unusedSearchElement; | ||
2399 | var updatedLeaf = true; | ||
2400 | while (updatedLeaf) | ||
2389 | { | 2401 | { |
2390 | var directorySearch = schemaElement as Wix.DirectorySearch; | 2402 | updatedLeaf = false; |
2391 | if (null != directorySearch) | 2403 | foreach (var schemaElement in parentElement.Children) |
2392 | { | 2404 | { |
2393 | var appSearchProperties = (StringCollection)appSearches[directorySearch.Id]; | 2405 | if (schemaElement is Wix.DirectorySearch directorySearch) |
2394 | |||
2395 | var unusedSearchSchemaElement = unusedSearchElement as Wix.ISchemaElement; | ||
2396 | if (null != appSearchProperties) | ||
2397 | { | 2406 | { |
2398 | var property = this.EnsureProperty(appSearchProperties[0]); | 2407 | parentElement = leafDirectorySearch = directorySearch; |
2399 | 2408 | updatedLeaf = true; | |
2400 | property.AddChild(unusedSearchSchemaElement); | ||
2401 | used = true; | ||
2402 | break; | 2409 | break; |
2403 | } | 2410 | } |
2404 | else if (ccpSearches.Contains(directorySearch.Id)) | 2411 | } |
2405 | { | 2412 | } |
2406 | complianceCheck.AddChild(unusedSearchSchemaElement); | 2413 | |
2407 | used = true; | 2414 | if (leafDirectorySearch != null) |
2408 | break; | 2415 | { |
2409 | } | 2416 | var appSearchProperties = (StringCollection)appSearches[leafDirectorySearch.Id]; |
2410 | else | 2417 | |
2411 | { | 2418 | var unusedSearchSchemaElement = unusedSearchElement as Wix.ISchemaElement; |
2412 | // TODO: warn | 2419 | if (null != appSearchProperties) |
2413 | } | 2420 | { |
2421 | var property = this.EnsureProperty(appSearchProperties[0]); | ||
2422 | |||
2423 | property.AddChild(unusedSearchSchemaElement); | ||
2424 | used = true; | ||
2425 | break; | ||
2426 | } | ||
2427 | else if (ccpSearches.Contains(leafDirectorySearch.Id)) | ||
2428 | { | ||
2429 | complianceCheck.AddChild(unusedSearchSchemaElement); | ||
2430 | used = true; | ||
2431 | break; | ||
2432 | } | ||
2433 | else | ||
2434 | { | ||
2435 | // TODO: warn | ||
2414 | } | 2436 | } |
2415 | } | 2437 | } |
2416 | 2438 | ||
diff --git a/src/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs b/src/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs index 5765cdfa..9893a525 100644 --- a/src/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs | |||
@@ -66,7 +66,7 @@ namespace WixToolsetTest.CoreIntegration | |||
66 | } | 66 | } |
67 | } | 67 | } |
68 | 68 | ||
69 | [Fact(Skip = "Test demonstrates failure")] | 69 | [Fact] |
70 | public void CanDecompileNestedDirSearchUnderRegSearch() | 70 | public void CanDecompileNestedDirSearchUnderRegSearch() |
71 | { | 71 | { |
72 | var folder = TestData.Get(@"TestData\AppSearch"); | 72 | var folder = TestData.Get(@"TestData\AppSearch"); |
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/AppSearch/DecompiledNestedDirSearchUnderRegSearch.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/AppSearch/DecompiledNestedDirSearchUnderRegSearch.wxs index 94ddfe19..6d78b2db 100644 --- a/src/test/WixToolsetTest.CoreIntegration/TestData/AppSearch/DecompiledNestedDirSearchUnderRegSearch.wxs +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/AppSearch/DecompiledNestedDirSearchUnderRegSearch.wxs | |||
@@ -18,7 +18,7 @@ | |||
18 | <Media Id="1" /> | 18 | <Media Id="1" /> |
19 | <Property Id="ALLUSERS" Value="1" /> | 19 | <Property Id="ALLUSERS" Value="1" /> |
20 | <Property Id="SAMPLEDIRFOUND"> | 20 | <Property Id="SAMPLEDIRFOUND"> |
21 | <RegistrySearch Id="SubRegSearch" Root="HKLM" Key="SampleReg" Type="raw"> | 21 | <RegistrySearch Id="SubRegSearch" Root="HKLM" Key="SampleReg" Type="raw" Win64="no"> |
22 | <DirectorySearch Id="SampleDirSearch" Path="SampleDir"> | 22 | <DirectorySearch Id="SampleDirSearch" Path="SampleDir"> |
23 | <DirectorySearch Id="SubDirSearch" Path="Subdir" /> | 23 | <DirectorySearch Id="SubDirSearch" Path="Subdir" /> |
24 | </DirectorySearch> | 24 | </DirectorySearch> |