From 3051bf2fc300df125115c9538a0bfc8256bfde6a Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Wed, 22 May 2019 16:28:02 -0700 Subject: Integrate short and source name changes to Directory and Shortcut tuples --- src/WixToolset.Core/Compiler.cs | 8 ++-- src/WixToolset.Core/Compiler_2.cs | 55 +--------------------- .../ExtensibilityServices/ParseHelper.cs | 36 ++++---------- 3 files changed, 15 insertions(+), 84 deletions(-) (limited to 'src/WixToolset.Core') diff --git a/src/WixToolset.Core/Compiler.cs b/src/WixToolset.Core/Compiler.cs index ea018d54..d543c6b8 100644 --- a/src/WixToolset.Core/Compiler.cs +++ b/src/WixToolset.Core/Compiler.cs @@ -4028,7 +4028,6 @@ namespace WixToolset.Core string shortName = null; string sourceName = null; string shortSourceName = null; - string defaultDir = null; string symbols = null; foreach (var attrib in node.Attributes()) @@ -4208,7 +4207,7 @@ namespace WixToolset.Core } // Calculate the DefaultDir for the directory row. - defaultDir = String.IsNullOrEmpty(shortName) ? name : String.Concat(shortName, "|", name); + var defaultDir = String.IsNullOrEmpty(shortName) ? name : String.Concat(shortName, "|", name); if (!String.IsNullOrEmpty(sourceName)) { defaultDir = String.Concat(defaultDir, ":", String.IsNullOrEmpty(shortSourceName) ? sourceName : String.Concat(shortSourceName, "|", sourceName)); @@ -4260,7 +4259,10 @@ namespace WixToolset.Core var tuple = new DirectoryTuple(sourceLineNumbers, id) { ParentDirectoryRef = parentId, - DefaultDir = defaultDir, + Name = name, + ShortName = shortName, + SourceName = sourceName, + SourceShortName = shortSourceName, ComponentGuidGenerationSeed = componentGuidGenerationSeed }; diff --git a/src/WixToolset.Core/Compiler_2.cs b/src/WixToolset.Core/Compiler_2.cs index beebd4f8..9e965465 100644 --- a/src/WixToolset.Core/Compiler_2.cs +++ b/src/WixToolset.Core/Compiler_2.cs @@ -4401,7 +4401,8 @@ namespace WixToolset.Core var tuple = new ShortcutTuple(sourceLineNumbers, id) { DirectoryRef = directory, - Name = this.GetMsiFilenameValue(shortName, name), + Name = name, + ShortName = shortName, ComponentRef = componentId, Target = target, Arguments = arguments, @@ -4418,58 +4419,6 @@ namespace WixToolset.Core }; this.Core.AddTuple(tuple); - - //var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.Shortcut, id); - //row.Set(1, directory); - //row.Set(2, this.GetMsiFilenameValue(shortName, name)); - //row.Set(3, componentId); - //if (advertise) - //{ - // if (YesNoType.Yes != parentKeyPath && "Component" != parentElementLocalName) - // { - // this.Core.Write(WarningMessages.UnclearShortcut(sourceLineNumbers, id.Id, componentId, defaultTarget)); - // } - // row.Set(4, Guid.Empty.ToString("B")); - //} - //else if (null != target) - //{ - // row.Set(4, target); - //} - //else if ("Component" == parentElementLocalName || "CreateFolder" == parentElementLocalName) - //{ - // row.Set(4, String.Format(CultureInfo.InvariantCulture, "[{0}]", defaultTarget)); - //} - //else if ("File" == parentElementLocalName) - //{ - // row.Set(4, String.Format(CultureInfo.InvariantCulture, "[#{0}]", defaultTarget)); - //} - //row.Set(5, arguments); - //row.Set(6, description); - //if (CompilerConstants.IntegerNotSet != hotkey) - //{ - // row.Set(7, hotkey); - //} - //row.Set(8, icon); - //if (CompilerConstants.IntegerNotSet != iconIndex) - //{ - // row.Set(9, iconIndex); - //} - - //if (show.HasValue) - //{ - // row.Set(10, show.Value); - //} - //row.Set(11, workingDirectory); - //row.Set(12, displayResourceDll); - //if (CompilerConstants.IntegerNotSet != displayResourceId) - //{ - // row.Set(13, displayResourceId); - //} - //row.Set(14, descriptionResourceDll); - //if (CompilerConstants.IntegerNotSet != descriptionResourceId) - //{ - // row.Set(15, descriptionResourceId); - //} } } diff --git a/src/WixToolset.Core/ExtensibilityServices/ParseHelper.cs b/src/WixToolset.Core/ExtensibilityServices/ParseHelper.cs index 0e80100b..3318b914 100644 --- a/src/WixToolset.Core/ExtensibilityServices/ParseHelper.cs +++ b/src/WixToolset.Core/ExtensibilityServices/ParseHelper.cs @@ -77,37 +77,14 @@ namespace WixToolset.Core.ExtensibilityServices public Identifier CreateDirectoryTuple(IntermediateSection section, SourceLineNumber sourceLineNumbers, Identifier id, string parentId, string name, ISet sectionInlinedDirectoryIds, string shortName = null, string sourceName = null, string shortSourceName = null) { - string defaultDir; - - if (name.Equals("SourceDir") || this.IsValidShortFilename(name, false)) - { - defaultDir = name; - } - else + if (String.IsNullOrEmpty(shortName) && !name.Equals("SourceDir") && !this.IsValidShortFilename(name)) { - if (String.IsNullOrEmpty(shortName)) - { - shortName = this.CreateShortName(name, false, false, "Directory", parentId); - } - - defaultDir = String.Concat(shortName, "|", name); + shortName = this.CreateShortName(name, false, false, "Directory", parentId); } - if (!String.IsNullOrEmpty(sourceName)) + if (String.IsNullOrEmpty(shortSourceName) && !String.IsNullOrEmpty(sourceName) && !this.IsValidShortFilename(sourceName)) { - if (this.IsValidShortFilename(sourceName, false)) - { - defaultDir = String.Concat(defaultDir, ":", sourceName); - } - else - { - if (String.IsNullOrEmpty(shortSourceName)) - { - shortSourceName = this.CreateShortName(sourceName, false, false, "Directory", parentId); - } - - defaultDir = String.Concat(defaultDir, ":", shortSourceName, "|", sourceName); - } + shortSourceName = this.CreateShortName(sourceName, false, false, "Directory", parentId); } // For anonymous directories, create the identifier. If this identifier already exists in the @@ -126,7 +103,10 @@ namespace WixToolset.Core.ExtensibilityServices var tuple = new DirectoryTuple(sourceLineNumbers, id) { ParentDirectoryRef = parentId, - DefaultDir = defaultDir, + Name = name, + ShortName = shortName, + SourceName = sourceName, + SourceShortName = shortSourceName }; section.Tuples.Add(tuple); -- cgit v1.2.3-55-g6feb