diff options
Diffstat (limited to 'src')
3 files changed, 59 insertions, 1 deletions
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/CreateWindowsInstallerDataFromIRCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/CreateWindowsInstallerDataFromIRCommand.cs index cee87df0..d34ca3fe 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/CreateWindowsInstallerDataFromIRCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/CreateWindowsInstallerDataFromIRCommand.cs | |||
| @@ -513,7 +513,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 513 | targetName = "."; | 513 | targetName = "."; |
| 514 | } | 514 | } |
| 515 | 515 | ||
| 516 | var defaultDir = String.IsNullOrEmpty(sourceName) ? targetName : targetName + ":" + sourceName; | 516 | var defaultDir = String.IsNullOrEmpty(sourceName) || sourceName == targetName ? targetName : targetName + ":" + sourceName; |
| 517 | 517 | ||
| 518 | var row = this.CreateRow(symbol, "Directory"); | 518 | var row = this.CreateRow(symbol, "Directory"); |
| 519 | row[0] = symbol.Id.Id; | 519 | row[0] = symbol.Id.Id; |
diff --git a/src/test/WixToolsetTest.CoreIntegration/DirectoryFixture.cs b/src/test/WixToolsetTest.CoreIntegration/DirectoryFixture.cs index fe5bb531..e0b85509 100644 --- a/src/test/WixToolsetTest.CoreIntegration/DirectoryFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/DirectoryFixture.cs | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | 2 | ||
| 3 | namespace WixToolsetTest.CoreIntegration | 3 | namespace WixToolsetTest.CoreIntegration |
| 4 | { | 4 | { |
| 5 | using System; | ||
| 5 | using System.IO; | 6 | using System.IO; |
| 6 | using System.Linq; | 7 | using System.Linq; |
| 7 | using WixBuildTools.TestSupport; | 8 | using WixBuildTools.TestSupport; |
| @@ -173,5 +174,51 @@ namespace WixToolsetTest.CoreIntegration | |||
| 173 | }, directoryRows.Select(r => r.FieldAsString(0) + ":" + r.FieldAsString(1) + ":" + r.FieldAsString(2)).ToArray()); | 174 | }, directoryRows.Select(r => r.FieldAsString(0) + ":" + r.FieldAsString(1) + ":" + r.FieldAsString(2)).ToArray()); |
| 174 | } | 175 | } |
| 175 | } | 176 | } |
| 177 | |||
| 178 | [Fact] | ||
| 179 | public void CanGetDuplicateTargetSourceName() | ||
| 180 | { | ||
| 181 | var folder = TestData.Get(@"TestData"); | ||
| 182 | |||
| 183 | using (var fs = new DisposableFileSystem()) | ||
| 184 | { | ||
| 185 | var baseFolder = fs.GetFolder(); | ||
| 186 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
| 187 | var msiPath = Path.Combine(baseFolder, @"bin\test.msi"); | ||
| 188 | |||
| 189 | var result = WixRunner.Execute(new[] | ||
| 190 | { | ||
| 191 | "build", | ||
| 192 | "-arch", "x64", | ||
| 193 | Path.Combine(folder, "Directory", "DuplicateTargetSourceName.wxs"), | ||
| 194 | Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), | ||
| 195 | "-bindpath", Path.Combine(folder, "SingleFile", "data"), | ||
| 196 | "-intermediateFolder", intermediateFolder, | ||
| 197 | "-o", msiPath | ||
| 198 | }); | ||
| 199 | |||
| 200 | result.AssertSuccess(); | ||
| 201 | |||
| 202 | var intermediate = Intermediate.Load(Path.Combine(baseFolder, @"bin\test.wixpdb")); | ||
| 203 | var section = intermediate.Sections.Single(); | ||
| 204 | |||
| 205 | var dirSymbols = section.Symbols.OfType<WixToolset.Data.Symbols.DirectorySymbol>().ToList(); | ||
| 206 | Assert.Equal(new[] | ||
| 207 | { | ||
| 208 | "BinFolder\tProgramFilesFolder\tbin", | ||
| 209 | "ProgramFilesFolder\tTARGETDIR\tPFiles", | ||
| 210 | "TARGETDIR\t\tSourceDir" | ||
| 211 | }, dirSymbols.OrderBy(d => d.Id.Id).Select(d => String.Join('\t', d.Id.Id, d.ParentDirectoryRef, d.Name)).ToArray()); | ||
| 212 | |||
| 213 | var data = WindowsInstallerData.Load(Path.Combine(baseFolder, @"bin\test.wixpdb")); | ||
| 214 | var directoryRows = data.Tables["Directory"].Rows; | ||
| 215 | Assert.Equal(new[] | ||
| 216 | { | ||
| 217 | "BinFolder\tProgramFilesFolder\tbin", | ||
| 218 | "ProgramFilesFolder\tTARGETDIR\tPFiles", | ||
| 219 | "TARGETDIR\t\tSourceDir" | ||
| 220 | }, directoryRows.Select(r => String.Join('\t', r.FieldAsString(0), r.FieldAsString(1), r.FieldAsString(2))).ToArray()); | ||
| 221 | } | ||
| 222 | } | ||
| 176 | } | 223 | } |
| 177 | } | 224 | } |
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/Directory/DuplicateTargetSourceName.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/Directory/DuplicateTargetSourceName.wxs new file mode 100644 index 00000000..6e9a4495 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/Directory/DuplicateTargetSourceName.wxs | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
| 3 | <Fragment> | ||
| 4 | <ComponentGroup Id="ProductComponents" Directory="BinFolder" /> | ||
| 5 | </Fragment> | ||
| 6 | <Fragment> | ||
| 7 | <StandardDirectory Id="ProgramFilesFolder"> | ||
| 8 | <Directory Id="BinFolder" Name="bin" SourceName="bin" /> | ||
| 9 | </StandardDirectory> | ||
| 10 | </Fragment> | ||
| 11 | </Wix> | ||
