aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Core.WindowsInstaller
diff options
context:
space:
mode:
Diffstat (limited to 'src/WixToolset.Core.WindowsInstaller')
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs70
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Decompile/Names.cs1
2 files changed, 41 insertions, 30 deletions
diff --git a/src/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs b/src/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs
index 8e477dd1..eb23f497 100644
--- a/src/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs
@@ -4289,53 +4289,57 @@ namespace WixToolset.Core.WindowsInstaller.Decompile
4289 foreach (var row in table.Rows) 4289 foreach (var row in table.Rows)
4290 { 4290 {
4291 var id = row.FieldAsString(0); 4291 var id = row.FieldAsString(0);
4292 var xDirectory = new XElement(Names.DirectoryElement, 4292 var elementName = WindowsInstallerStandard.IsStandardDirectory(id) ? Names.StandardDirectoryElement : Names.DirectoryElement;
4293 var xDirectory = new XElement(elementName,
4293 new XAttribute("Id", id)); 4294 new XAttribute("Id", id));
4294 4295
4295 var names = this.BackendHelper.SplitMsiFileName(row.FieldAsString(2)); 4296 if (!WindowsInstallerStandard.IsStandardDirectory(id))
4296
4297 if (String.Equals(id, "TARGETDIR", StringComparison.Ordinal) && !String.Equals(names[0], "SourceDir", StringComparison.Ordinal))
4298 {
4299 this.Messaging.Write(WarningMessages.TargetDirCorrectedDefaultDir());
4300 xDirectory.SetAttributeValue("Name", "SourceDir");
4301 }
4302 else
4303 { 4297 {
4304 if (null != names[0] && "." != names[0]) 4298 var names = this.BackendHelper.SplitMsiFileName(row.FieldAsString(2));
4299
4300 if (id == "TARGETDIR" && names[0] != "SourceDir")
4305 { 4301 {
4306 if (null != names[1]) 4302 this.Messaging.Write(WarningMessages.TargetDirCorrectedDefaultDir());
4303 xDirectory.SetAttributeValue("Name", "SourceDir");
4304 }
4305 else
4306 {
4307 if (null != names[0] && "." != names[0])
4307 { 4308 {
4308 xDirectory.SetAttributeValue("ShortName", names[0]); 4309 if (null != names[1])
4310 {
4311 xDirectory.SetAttributeValue("ShortName", names[0]);
4312 }
4313 else
4314 {
4315 xDirectory.SetAttributeValue("Name", names[0]);
4316 }
4309 } 4317 }
4310 else 4318
4319 if (null != names[1])
4311 { 4320 {
4312 xDirectory.SetAttributeValue("Name", names[0]); 4321 xDirectory.SetAttributeValue("Name", names[1]);
4313 } 4322 }
4314 } 4323 }
4315 4324
4316 if (null != names[1]) 4325 if (null != names[2])
4317 { 4326 {
4318 xDirectory.SetAttributeValue("Name", names[1]); 4327 if (null != names[3])
4328 {
4329 xDirectory.SetAttributeValue("ShortSourceName", names[2]);
4330 }
4331 else
4332 {
4333 xDirectory.SetAttributeValue("SourceName", names[2]);
4334 }
4319 } 4335 }
4320 }
4321 4336
4322 if (null != names[2])
4323 {
4324 if (null != names[3]) 4337 if (null != names[3])
4325 { 4338 {
4326 xDirectory.SetAttributeValue("ShortSourceName", names[2]); 4339 xDirectory.SetAttributeValue("SourceName", names[3]);
4327 }
4328 else
4329 {
4330 xDirectory.SetAttributeValue("SourceName", names[2]);
4331 } 4340 }
4332 } 4341 }
4333 4342
4334 if (null != names[3])
4335 {
4336 xDirectory.SetAttributeValue("SourceName", names[3]);
4337 }
4338
4339 this.IndexElement(row, xDirectory); 4343 this.IndexElement(row, xDirectory);
4340 } 4344 }
4341 4345
@@ -4344,7 +4348,13 @@ namespace WixToolset.Core.WindowsInstaller.Decompile
4344 { 4348 {
4345 var xDirectory = this.GetIndexedElement(row); 4349 var xDirectory = this.GetIndexedElement(row);
4346 4350
4347 if (row.IsColumnNull(1)) 4351 var id = row.FieldAsString(0);
4352
4353 if (id == "TARGETDIR")
4354 {
4355 // Skip TARGETDIR.
4356 }
4357 else if (row.IsColumnNull(1) || WindowsInstallerStandard.IsStandardDirectory(id))
4348 { 4358 {
4349 this.RootElement.Add(xDirectory); 4359 this.RootElement.Add(xDirectory);
4350 } 4360 }
diff --git a/src/WixToolset.Core.WindowsInstaller/Decompile/Names.cs b/src/WixToolset.Core.WindowsInstaller/Decompile/Names.cs
index 82258c57..db65bbf7 100644
--- a/src/WixToolset.Core.WindowsInstaller/Decompile/Names.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Decompile/Names.cs
@@ -69,6 +69,7 @@ namespace WixToolset.Core.WindowsInstaller.Decompile
69 69
70 public static readonly XName LevelElement = WxsNamespace + "Level"; 70 public static readonly XName LevelElement = WxsNamespace + "Level";
71 public static readonly XName DialogElement = WxsNamespace + "Dialog"; 71 public static readonly XName DialogElement = WxsNamespace + "Dialog";
72 public static readonly XName StandardDirectoryElement = WxsNamespace + "StandardDirectory";
72 public static readonly XName DirectoryElement = WxsNamespace + "Directory"; 73 public static readonly XName DirectoryElement = WxsNamespace + "Directory";
73 public static readonly XName DirectorySearchElement = WxsNamespace + "DirectorySearch"; 74 public static readonly XName DirectorySearchElement = WxsNamespace + "DirectorySearch";
74 public static readonly XName CopyFileElement = WxsNamespace + "CopyFile"; 75 public static readonly XName CopyFileElement = WxsNamespace + "CopyFile";