Support associating export units with packages in subdirectories (1.12) by JohnMcPMS · Pull Request #5866 · microsoft/winget-cli

@JohnMcPMS

…nstall location (microsoft#5859)

## Change
The primary motivation is to support directories below the install
location to contain configuration units that we will associate with the
package. This is achieved by refactoring the association logic from a
Package x Unit loop into a tree structure that is colored by package
install locations. This also has the benefit of making a O(N^2)
algorithm into an O(N).

Units are first inserted into the tree based on their file path. Then
the install location of each package is recorded onto that tree as well.
Finally, during the export of each package, all resources at the install
location and any that are descended from it but not under another
package are included.

florelis

approved these changes Nov 10, 2025