public void Execute()
        {
            var directories  = this.Section.Symbols.OfType <DirectorySymbol>().ToList();
            var directoryIds = new SortedSet <string>(directories.Select(d => d.Id.Id));

            foreach (var directory in directories)
            {
                var parentDirectoryId = directory.ParentDirectoryRef;

                if (String.IsNullOrEmpty(parentDirectoryId))
                {
                    if (directory.Id.Id != "TARGETDIR")
                    {
                        directory.ParentDirectoryRef = "TARGETDIR";
                    }
                }
                else
                {
                    this.EnsureStandardDirectoryAdded(directoryIds, parentDirectoryId, directory.SourceLineNumbers);
                }
            }

            if (!directoryIds.Contains("TARGETDIR") && WindowsInstallerStandard.TryGetStandardDirectory("TARGETDIR", out var targetDir))
            {
                directoryIds.Add(targetDir.Id.Id);
                this.Section.AddSymbol(targetDir);
            }
        }
        private void EnsureStandardDirectoryAdded(ISet <string> directoryIds, string directoryId, SourceLineNumber sourceLineNumbers)
        {
            if (!directoryIds.Contains(directoryId) && WindowsInstallerStandard.TryGetStandardDirectory(directoryId, out var standardDirectory))
            {
                var parentDirectoryId = this.GetStandardDirectoryParent(directoryId);

                var directory = new DirectorySymbol(sourceLineNumbers, standardDirectory.Id)
                {
                    Name = standardDirectory.Name,
                    ParentDirectoryRef = parentDirectoryId,
                };

                directoryIds.Add(directory.Id.Id);
                this.Section.AddSymbol(directory);

                if (!String.IsNullOrEmpty(parentDirectoryId))
                {
                    this.EnsureStandardDirectoryAdded(directoryIds, parentDirectoryId, sourceLineNumbers);
                }
            }
        }