From c8c73ccddedcb64f9989e3d5a9f15240b476b551 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Fri, 27 Jul 2018 00:35:52 -0700 Subject: Remove WixFileNotFoundException, report checked paths and improve bind path command-line parsing --- src/WixToolset.Core/CommandLine/CommandLineParser.cs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src/WixToolset.Core/CommandLine') diff --git a/src/WixToolset.Core/CommandLine/CommandLineParser.cs b/src/WixToolset.Core/CommandLine/CommandLineParser.cs index 92944ab2..d518931a 100644 --- a/src/WixToolset.Core/CommandLine/CommandLineParser.cs +++ b/src/WixToolset.Core/CommandLine/CommandLineParser.cs @@ -22,6 +22,8 @@ namespace WixToolset.Core.CommandLine internal class CommandLineParser : ICommandLineParser { + private static readonly char[] BindPathSplit = { '=' }; + public CommandLineParser(IServiceProvider serviceProvider) { this.ServiceProvider = serviceProvider; @@ -380,15 +382,15 @@ namespace WixToolset.Core.CommandLine foreach (var bindPath in bindPaths) { - var bp = BindPath.Parse(bindPath); + var bp = ParseBindPath(bindPath); - if (Directory.Exists(bp.Path)) + if (File.Exists(bp.Path)) { - result.Add(bp); + this.Messaging.Write(ErrorMessages.ExpectedDirectoryGotFile("-bindpath", bp.Path)); } - else if (File.Exists(bp.Path)) + else { - this.Messaging.Write(ErrorMessages.ExpectedDirectoryGotFile("-bindpath", bp.Path)); + result.Add(bp); } } @@ -407,5 +409,11 @@ namespace WixToolset.Core.CommandLine return false; } + + public static BindPath ParseBindPath(string bindPath) + { + string[] namedPath = bindPath.Split(BindPathSplit, 2); + return (1 == namedPath.Length) ? new BindPath(namedPath[0]) : new BindPath(namedPath[0], namedPath[1]); + } } } -- cgit v1.2.3-55-g6feb