aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Core
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2019-05-22 16:28:02 -0700
committerRob Mensching <rob@firegiant.com>2019-05-23 16:02:37 -0700
commit3051bf2fc300df125115c9538a0bfc8256bfde6a (patch)
tree65aa2e091a6a5fa983314ab9cb55a72ba16faf02 /src/WixToolset.Core
parent3859a8cd7d6001f7b49c22065e33242ddb486fbb (diff)
downloadwix-3051bf2fc300df125115c9538a0bfc8256bfde6a.tar.gz
wix-3051bf2fc300df125115c9538a0bfc8256bfde6a.tar.bz2
wix-3051bf2fc300df125115c9538a0bfc8256bfde6a.zip
Integrate short and source name changes to Directory and Shortcut tuples
Diffstat (limited to 'src/WixToolset.Core')
-rw-r--r--src/WixToolset.Core/Compiler.cs8
-rw-r--r--src/WixToolset.Core/Compiler_2.cs55
-rw-r--r--src/WixToolset.Core/ExtensibilityServices/ParseHelper.cs36
3 files changed, 15 insertions, 84 deletions
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
4028 string shortName = null; 4028 string shortName = null;
4029 string sourceName = null; 4029 string sourceName = null;
4030 string shortSourceName = null; 4030 string shortSourceName = null;
4031 string defaultDir = null;
4032 string symbols = null; 4031 string symbols = null;
4033 4032
4034 foreach (var attrib in node.Attributes()) 4033 foreach (var attrib in node.Attributes())
@@ -4208,7 +4207,7 @@ namespace WixToolset.Core
4208 } 4207 }
4209 4208
4210 // Calculate the DefaultDir for the directory row. 4209 // Calculate the DefaultDir for the directory row.
4211 defaultDir = String.IsNullOrEmpty(shortName) ? name : String.Concat(shortName, "|", name); 4210 var defaultDir = String.IsNullOrEmpty(shortName) ? name : String.Concat(shortName, "|", name);
4212 if (!String.IsNullOrEmpty(sourceName)) 4211 if (!String.IsNullOrEmpty(sourceName))
4213 { 4212 {
4214 defaultDir = String.Concat(defaultDir, ":", String.IsNullOrEmpty(shortSourceName) ? sourceName : String.Concat(shortSourceName, "|", sourceName)); 4213 defaultDir = String.Concat(defaultDir, ":", String.IsNullOrEmpty(shortSourceName) ? sourceName : String.Concat(shortSourceName, "|", sourceName));
@@ -4260,7 +4259,10 @@ namespace WixToolset.Core
4260 var tuple = new DirectoryTuple(sourceLineNumbers, id) 4259 var tuple = new DirectoryTuple(sourceLineNumbers, id)
4261 { 4260 {
4262 ParentDirectoryRef = parentId, 4261 ParentDirectoryRef = parentId,
4263 DefaultDir = defaultDir, 4262 Name = name,
4263 ShortName = shortName,
4264 SourceName = sourceName,
4265 SourceShortName = shortSourceName,
4264 ComponentGuidGenerationSeed = componentGuidGenerationSeed 4266 ComponentGuidGenerationSeed = componentGuidGenerationSeed
4265 }; 4267 };
4266 4268
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
4401 var tuple = new ShortcutTuple(sourceLineNumbers, id) 4401 var tuple = new ShortcutTuple(sourceLineNumbers, id)
4402 { 4402 {
4403 DirectoryRef = directory, 4403 DirectoryRef = directory,
4404 Name = this.GetMsiFilenameValue(shortName, name), 4404 Name = name,
4405 ShortName = shortName,
4405 ComponentRef = componentId, 4406 ComponentRef = componentId,
4406 Target = target, 4407 Target = target,
4407 Arguments = arguments, 4408 Arguments = arguments,
@@ -4418,58 +4419,6 @@ namespace WixToolset.Core
4418 }; 4419 };
4419 4420
4420 this.Core.AddTuple(tuple); 4421 this.Core.AddTuple(tuple);
4421
4422 //var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.Shortcut, id);
4423 //row.Set(1, directory);
4424 //row.Set(2, this.GetMsiFilenameValue(shortName, name));
4425 //row.Set(3, componentId);
4426 //if (advertise)
4427 //{
4428 // if (YesNoType.Yes != parentKeyPath && "Component" != parentElementLocalName)
4429 // {
4430 // this.Core.Write(WarningMessages.UnclearShortcut(sourceLineNumbers, id.Id, componentId, defaultTarget));
4431 // }
4432 // row.Set(4, Guid.Empty.ToString("B"));
4433 //}
4434 //else if (null != target)
4435 //{
4436 // row.Set(4, target);
4437 //}
4438 //else if ("Component" == parentElementLocalName || "CreateFolder" == parentElementLocalName)
4439 //{
4440 // row.Set(4, String.Format(CultureInfo.InvariantCulture, "[{0}]", defaultTarget));
4441 //}
4442 //else if ("File" == parentElementLocalName)
4443 //{
4444 // row.Set(4, String.Format(CultureInfo.InvariantCulture, "[#{0}]", defaultTarget));
4445 //}
4446 //row.Set(5, arguments);
4447 //row.Set(6, description);
4448 //if (CompilerConstants.IntegerNotSet != hotkey)
4449 //{
4450 // row.Set(7, hotkey);
4451 //}
4452 //row.Set(8, icon);
4453 //if (CompilerConstants.IntegerNotSet != iconIndex)
4454 //{
4455 // row.Set(9, iconIndex);
4456 //}
4457
4458 //if (show.HasValue)
4459 //{
4460 // row.Set(10, show.Value);
4461 //}
4462 //row.Set(11, workingDirectory);
4463 //row.Set(12, displayResourceDll);
4464 //if (CompilerConstants.IntegerNotSet != displayResourceId)
4465 //{
4466 // row.Set(13, displayResourceId);
4467 //}
4468 //row.Set(14, descriptionResourceDll);
4469 //if (CompilerConstants.IntegerNotSet != descriptionResourceId)
4470 //{
4471 // row.Set(15, descriptionResourceId);
4472 //}
4473 } 4422 }
4474 } 4423 }
4475 4424
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
77 77
78 public Identifier CreateDirectoryTuple(IntermediateSection section, SourceLineNumber sourceLineNumbers, Identifier id, string parentId, string name, ISet<string> sectionInlinedDirectoryIds, string shortName = null, string sourceName = null, string shortSourceName = null) 78 public Identifier CreateDirectoryTuple(IntermediateSection section, SourceLineNumber sourceLineNumbers, Identifier id, string parentId, string name, ISet<string> sectionInlinedDirectoryIds, string shortName = null, string sourceName = null, string shortSourceName = null)
79 { 79 {
80 string defaultDir; 80 if (String.IsNullOrEmpty(shortName) && !name.Equals("SourceDir") && !this.IsValidShortFilename(name))
81
82 if (name.Equals("SourceDir") || this.IsValidShortFilename(name, false))
83 {
84 defaultDir = name;
85 }
86 else
87 { 81 {
88 if (String.IsNullOrEmpty(shortName)) 82 shortName = this.CreateShortName(name, false, false, "Directory", parentId);
89 {
90 shortName = this.CreateShortName(name, false, false, "Directory", parentId);
91 }
92
93 defaultDir = String.Concat(shortName, "|", name);
94 } 83 }
95 84
96 if (!String.IsNullOrEmpty(sourceName)) 85 if (String.IsNullOrEmpty(shortSourceName) && !String.IsNullOrEmpty(sourceName) && !this.IsValidShortFilename(sourceName))
97 { 86 {
98 if (this.IsValidShortFilename(sourceName, false)) 87 shortSourceName = this.CreateShortName(sourceName, false, false, "Directory", parentId);
99 {
100 defaultDir = String.Concat(defaultDir, ":", sourceName);
101 }
102 else
103 {
104 if (String.IsNullOrEmpty(shortSourceName))
105 {
106 shortSourceName = this.CreateShortName(sourceName, false, false, "Directory", parentId);
107 }
108
109 defaultDir = String.Concat(defaultDir, ":", shortSourceName, "|", sourceName);
110 }
111 } 88 }
112 89
113 // For anonymous directories, create the identifier. If this identifier already exists in the 90 // For anonymous directories, create the identifier. If this identifier already exists in the
@@ -126,7 +103,10 @@ namespace WixToolset.Core.ExtensibilityServices
126 var tuple = new DirectoryTuple(sourceLineNumbers, id) 103 var tuple = new DirectoryTuple(sourceLineNumbers, id)
127 { 104 {
128 ParentDirectoryRef = parentId, 105 ParentDirectoryRef = parentId,
129 DefaultDir = defaultDir, 106 Name = name,
107 ShortName = shortName,
108 SourceName = sourceName,
109 SourceShortName = shortSourceName
130 }; 110 };
131 111
132 section.Tuples.Add(tuple); 112 section.Tuples.Add(tuple);