Skip to content

Commit

Permalink
- Updated all IGenericEntity implementations to support 'no-directory…
Browse files Browse the repository at this point in the history
…' deployments
  • Loading branch information
oleg-shilo committed Apr 14, 2018
1 parent 95b3c6a commit 38453cc
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 11 deletions.
6 changes: 5 additions & 1 deletion Source/src/WixSharp/Certificate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,11 @@ public void Process(ProcessingContext context)

XElement component = this.CreateParentComponent();
component.Add(this.ToXElement(WixExtension.IIs, "Certificate"));
context.XParent.FindFirst("Component").Parent?.Add(component);

XElement bestParent = context.XParent.FindFirstComponentParent() ??
context.XParent.FistProgramFilesDir();

bestParent.Add(component);

MapComponentToFeatures(component.Attribute("Id")?.Value, ActualFeatures, context);
}
Expand Down
6 changes: 3 additions & 3 deletions Source/src/WixSharp/EnvironmentVariable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,10 @@ public void Process(ProcessingContext context)
.AddAttributes(Condition.Attributes));
}

var parent = context.XParent.FindFirstComponentParent() ??
context.XParent.FindLastDirectory();
XElement bestParent = context.XParent.FindFirstComponentParent() ??
context.XParent.FistProgramFilesDir();

parent?.Add(component);
bestParent.Add(component);

MapComponentToFeatures(component.Attr("Id"), ActualFeatures, context);
}
Expand Down
6 changes: 5 additions & 1 deletion Source/src/WixSharp/IniFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,11 @@ public void Process(ProcessingContext context)
{
XElement component = this.CreateParentComponent();
component.Add(this.ToXElement("IniFile"));
context.XParent.FindFirst("Component").Parent?.Add(component);

XElement bestParent = context.XParent.FindFirstComponentParent() ??
context.XParent.FistProgramFilesDir();

bestParent.Add(component);

MapComponentToFeatures(component.Attr("Id"), ActualFeatures, context);
}
Expand Down
6 changes: 5 additions & 1 deletion Source/src/WixSharp/RemoveRegistryKey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,11 @@ public void Process(ProcessingContext context)
{
XElement component = this.CreateParentComponent();
component.Add(this.ToXElement("RemoveRegistryKey"));
context.XParent.FindFirst("Component").Parent?.Add(component);

XElement bestParent = context.XParent.FindFirstComponentParent() ??
context.XParent.FistProgramFilesDir();

bestParent.Add(component);

MapComponentToFeatures(component.Attr("Id"), ActualFeatures, context);
}
Expand Down
6 changes: 5 additions & 1 deletion Source/src/WixSharp/RemoveRegistryValue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,11 @@ public void Process(ProcessingContext context)
{
XElement component = this.CreateParentComponent();
component.Add(this.ToXElement("RemoveRegistryValue"));
context.XParent.FindFirst("Component").Parent?.Add(component);

XElement bestParent = context.XParent.FindFirstComponentParent() ??
context.XParent.FistProgramFilesDir();

bestParent.Add(component);

MapComponentToFeatures(component.Attr("Id"), ActualFeatures, context);
}
Expand Down
5 changes: 4 additions & 1 deletion Source/src/WixSharp/SqlDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,10 @@ public void Process(ProcessingContext context)
item.Process(newContext);
}

context.XParent.FindFirst("Component").Parent?.Add(component);
XElement bestParent = context.XParent.FindFirstComponentParent() ??
context.XParent.FistProgramFilesDir();

bestParent.Add(component);
MapComponentToFeatures(component.Attr("Id"), ActualFeatures, context);
}
else
Expand Down
6 changes: 5 additions & 1 deletion Source/src/WixSharp/SqlScript.cs
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,11 @@ public void Process(ProcessingContext context)
XElement sqlScript = this.ToXElement(WixExtension.Sql, "SqlScript");
component.Add(sqlScript);

context.XParent.FindFirst("Component").Parent?.Add(component);
XElement bestParent = context.XParent.FindFirstComponentParent() ??
context.XParent.FistProgramFilesDir();

bestParent.Add(component);

MapComponentToFeatures(component.Attr("Id"), ActualFeatures, context);
}
else
Expand Down
6 changes: 5 additions & 1 deletion Source/src/WixSharp/SqlString.cs
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,11 @@ public void Process(ProcessingContext context)
XElement sqlString = this.ToXElement(WixExtension.Sql, "SqlString");
component.Add(sqlString);

context.XParent.FindFirst("Component").Parent?.Add(component);
XElement bestParent = context.XParent.FindFirstComponentParent() ??
context.XParent.FistProgramFilesDir();

bestParent.Add(component);

MapComponentToFeatures(component.Attr("Id"), ActualFeatures, context);
}
else
Expand Down
2 changes: 1 addition & 1 deletion Source/src/WixSharp/User.cs
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ public void Process(ProcessingContext context)
XElement component = this.CreateParentComponent();
component.Add(this.ToXElement(WixExtension.Util, "User"));

XElement bestParent = context.XParent.FindFirst("Component")?.Parent ??
XElement bestParent = context.XParent.FindFirstComponentParent() ??
context.XParent.FistProgramFilesDir();

bestParent.Add(component);
Expand Down

0 comments on commit 38453cc

Please sign in to comment.