From 8a4c0810ea2756888df18b0da5813e8c5bad4c54 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Mon, 21 Nov 2022 00:05:14 -0800 Subject: Improve file not found error message Fixes 2805 --- src/api/wix/WixToolset.Data/ErrorMessages.cs | 12 ++++++------ .../Bundles/HarvestBundlePackageCommand.cs | 4 ++-- .../WixToolset.Core.Burn/Bundles/ProcessMsiPackageCommand.cs | 4 ++-- src/wix/WixToolset.Core/CommandLine/BuildCommand.cs | 2 +- src/wix/test/WixToolsetTest.CoreIntegration/MsiFixture.cs | 4 ++-- src/wix/test/WixToolsetTest.CoreIntegration/PatchFixture.cs | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/api/wix/WixToolset.Data/ErrorMessages.cs b/src/api/wix/WixToolset.Data/ErrorMessages.cs index 0c7511b9..070abd69 100644 --- a/src/api/wix/WixToolset.Data/ErrorMessages.cs +++ b/src/api/wix/WixToolset.Data/ErrorMessages.cs @@ -640,19 +640,19 @@ namespace WixToolset.Data public static Message FileNotFound(SourceLineNumber sourceLineNumbers, string file) { - return Message(sourceLineNumbers, Ids.FileNotFound, "The system cannot find the file '{0}'.", file); + return Message(sourceLineNumbers, Ids.FileNotFound, "Cannot find the file '{0}'.", file); } public static Message FileNotFound(SourceLineNumber sourceLineNumbers, string file, string fileType) { - return Message(sourceLineNumbers, Ids.FileNotFound, "The system cannot find the file '{0}' with type '{1}'.", file, fileType); + return Message(sourceLineNumbers, Ids.FileNotFound, "Cannot find the {0} file '{1}'.", fileType, file); } public static Message FileNotFound(SourceLineNumber sourceLineNumbers, string file, string fileType, IEnumerable checkedPaths) { var combinedCheckedPaths = String.Join(", ", checkedPaths); - var withType = String.IsNullOrEmpty(fileType) ? String.Empty : $" with type '{fileType}'"; - return Message(sourceLineNumbers, Ids.FileNotFound, "The system cannot find the file '{0}'{1}. The following paths were checked: {2}", file, withType, combinedCheckedPaths); + var fileTypePrefix = String.IsNullOrEmpty(fileType) ? String.Empty : fileType + " "; + return Message(sourceLineNumbers, Ids.FileNotFound, "Cannot find the {0}file '{1}'. The following paths were checked: {2}", fileTypePrefix, file, combinedCheckedPaths); } public static Message FileOrDirectoryPathRequired(string parameter) @@ -662,12 +662,12 @@ namespace WixToolset.Data public static Message FilePathRequired(string filePurpose) { - return Message(null, Ids.FilePathRequired, "The path to {0} is required.", filePurpose); + return Message(null, Ids.FilePathRequired, "The path to the {0} is required.", filePurpose); } public static Message FilePathRequired(string parameter, string filePurpose) { - return Message(null, Ids.FilePathRequired, "The parameter '{0}' must be followed by a file path for {1}.", parameter, filePurpose); + return Message(null, Ids.FilePathRequired, "The parameter '{0}' must be followed by a file path for the {1}.", parameter, filePurpose); } public static Message FileTooLarge(SourceLineNumber sourceLineNumbers, string fileName) diff --git a/src/wix/WixToolset.Core.Burn/Bundles/HarvestBundlePackageCommand.cs b/src/wix/WixToolset.Core.Burn/Bundles/HarvestBundlePackageCommand.cs index bc065f2f..0973331f 100644 --- a/src/wix/WixToolset.Core.Burn/Bundles/HarvestBundlePackageCommand.cs +++ b/src/wix/WixToolset.Core.Burn/Bundles/HarvestBundlePackageCommand.cs @@ -281,7 +281,7 @@ namespace WixToolset.Core.Burn.Bundles if (!payloadNames.Contains(containerFullName)) { var generatedId = this.BackendHelper.GenerateIdentifier("hcp", this.PackagePayload.Id.Id, containerName); - var payloadSourceFile = this.ResolveRelatedFile(this.PackagePayload.SourceFile.Path, this.PackagePayload.UnresolvedSourceFile, containerName, "Container", this.PackagePayload.SourceLineNumbers); + var payloadSourceFile = this.ResolveRelatedFile(this.PackagePayload.SourceFile.Path, this.PackagePayload.UnresolvedSourceFile, containerName, "container", this.PackagePayload.SourceLineNumbers); this.Payloads.Add(new WixBundlePayloadSymbol(this.PackagePayload.SourceLineNumbers, new Identifier(AccessModifier.Section, generatedId)) { @@ -341,7 +341,7 @@ namespace WixToolset.Core.Burn.Bundles if (!payloadNames.Contains(payloadFullName)) { var generatedId = this.BackendHelper.GenerateIdentifier("hpp", this.PackagePayload.Id.Id, payloadName); - var payloadSourceFile = this.ResolveRelatedFile(this.PackagePayload.SourceFile.Path, this.PackagePayload.UnresolvedSourceFile, payloadName, "Payload", this.PackagePayload.SourceLineNumbers); + var payloadSourceFile = this.ResolveRelatedFile(this.PackagePayload.SourceFile.Path, this.PackagePayload.UnresolvedSourceFile, payloadName, "payload", this.PackagePayload.SourceLineNumbers); this.Payloads.Add(new WixBundlePayloadSymbol(this.PackagePayload.SourceLineNumbers, new Identifier(AccessModifier.Section, generatedId)) { diff --git a/src/wix/WixToolset.Core.Burn/Bundles/ProcessMsiPackageCommand.cs b/src/wix/WixToolset.Core.Burn/Bundles/ProcessMsiPackageCommand.cs index 72da0c0b..71e0d7de 100644 --- a/src/wix/WixToolset.Core.Burn/Bundles/ProcessMsiPackageCommand.cs +++ b/src/wix/WixToolset.Core.Burn/Bundles/ProcessMsiPackageCommand.cs @@ -452,7 +452,7 @@ namespace WixToolset.Core.Burn.Bundles if (!payloadNames.Contains(cabinetName)) { var generatedId = this.BackendHelper.GenerateIdentifier("cab", this.PackagePayload.Id.Id, cabinet); - var payloadSourceFile = this.ResolveRelatedFile(this.PackagePayload.SourceFile.Path, this.PackagePayload.UnresolvedSourceFile, cabinet, "Cabinet", sourceLineNumbers); + var payloadSourceFile = this.ResolveRelatedFile(this.PackagePayload.SourceFile.Path, this.PackagePayload.UnresolvedSourceFile, cabinet, "cabinet", sourceLineNumbers); this.Section.AddSymbol(new WixBundlePayloadSymbol(sourceLineNumbers, new Identifier(AccessModifier.Section, generatedId)) { @@ -516,7 +516,7 @@ namespace WixToolset.Core.Burn.Bundles if (!payloadNames.Contains(name)) { var generatedId = this.BackendHelper.GenerateIdentifier("f", this.PackagePayload.Id.Id, record.GetString(2)); - var payloadSourceFile = this.ResolveRelatedFile(this.PackagePayload.SourceFile.Path, this.PackagePayload.UnresolvedSourceFile, fileSourcePath, "File", sourceLineNumbers); + var payloadSourceFile = this.ResolveRelatedFile(this.PackagePayload.SourceFile.Path, this.PackagePayload.UnresolvedSourceFile, fileSourcePath, "payload", sourceLineNumbers); this.Section.AddSymbol(new WixBundlePayloadSymbol(sourceLineNumbers, new Identifier(AccessModifier.Section, generatedId)) { diff --git a/src/wix/WixToolset.Core/CommandLine/BuildCommand.cs b/src/wix/WixToolset.Core/CommandLine/BuildCommand.cs index aaa14396..6b56f827 100644 --- a/src/wix/WixToolset.Core/CommandLine/BuildCommand.cs +++ b/src/wix/WixToolset.Core/CommandLine/BuildCommand.cs @@ -697,7 +697,7 @@ namespace WixToolset.Core.CommandLine } else { - parser.GetArgumentAsFilePathOrError(arg, "input file", this.UnclassifiedInputFilePaths); + parser.GetArgumentAsFilePathOrError(arg, "input", this.UnclassifiedInputFilePaths); return true; } } diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/MsiFixture.cs b/src/wix/test/WixToolsetTest.CoreIntegration/MsiFixture.cs index e83fe4f0..60b6c686 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/MsiFixture.cs +++ b/src/wix/test/WixToolsetTest.CoreIntegration/MsiFixture.cs @@ -84,8 +84,8 @@ namespace WixToolsetTest.CoreIntegration var errorMessages = messages.Select(m => m.ToString().Replace(folder, "")).ToArray(); WixAssert.CompareLineByLine(new[] { - @"The system cannot find the file 'test.txt' with type 'File'. The following paths were checked: test.txt, \does-not-exist\test.txt, \also-does-not-exist\test.txt", - @"The system cannot find the file 'test.txt' with type 'File'. The following paths were checked: test.txt, \does-not-exist\test.txt, \also-does-not-exist\test.txt", + @"Cannot find the File file 'test.txt'. The following paths were checked: test.txt, \does-not-exist\test.txt, \also-does-not-exist\test.txt", + @"Cannot find the File file 'test.txt'. The following paths were checked: test.txt, \does-not-exist\test.txt, \also-does-not-exist\test.txt", }, errorMessages); var errorMessage = errorMessages.First(); diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/PatchFixture.cs b/src/wix/test/WixToolsetTest.CoreIntegration/PatchFixture.cs index 69aa9c95..f850615e 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/PatchFixture.cs +++ b/src/wix/test/WixToolsetTest.CoreIntegration/PatchFixture.cs @@ -391,7 +391,7 @@ namespace WixToolsetTest.CoreIntegration var messages = result.Messages.Select(m => m.ToString().Replace(tempFolderPatch, "").Replace(templateBaselineFolder, "").Replace(templateUpdateFolder, "")).ToArray(); WixAssert.CompareLineByLine(new[] { - @"The system cannot find the file 'Missing.wixpdb' with type 'WixPatchBaseline'. The following paths were checked: Missing.wixpdb, \bin\Missing.wixpdb, \Missing.wixpdb, \Missing.wixpdb", + @"Cannot find the WixPatchBaseline file 'Missing.wixpdb'. The following paths were checked: Missing.wixpdb, \bin\Missing.wixpdb, \Missing.wixpdb, \Missing.wixpdb", }, messages); } } -- cgit v1.2.3-55-g6feb