aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Core/CommandLine/CommandLineParser.cs
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2018-07-27 00:35:52 -0700
committerRob Mensching <rob@firegiant.com>2018-07-27 11:31:18 -0700
commitc8c73ccddedcb64f9989e3d5a9f15240b476b551 (patch)
tree099f35daf71912b211223abcefafc97068971217 /src/WixToolset.Core/CommandLine/CommandLineParser.cs
parent854e616eb3516c7405691b679617aa08c1dd1cdd (diff)
downloadwix-c8c73ccddedcb64f9989e3d5a9f15240b476b551.tar.gz
wix-c8c73ccddedcb64f9989e3d5a9f15240b476b551.tar.bz2
wix-c8c73ccddedcb64f9989e3d5a9f15240b476b551.zip
Remove WixFileNotFoundException, report checked paths and improve bind path command-line parsing
Diffstat (limited to 'src/WixToolset.Core/CommandLine/CommandLineParser.cs')
-rw-r--r--src/WixToolset.Core/CommandLine/CommandLineParser.cs18
1 files changed, 13 insertions, 5 deletions
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
22 22
23 internal class CommandLineParser : ICommandLineParser 23 internal class CommandLineParser : ICommandLineParser
24 { 24 {
25 private static readonly char[] BindPathSplit = { '=' };
26
25 public CommandLineParser(IServiceProvider serviceProvider) 27 public CommandLineParser(IServiceProvider serviceProvider)
26 { 28 {
27 this.ServiceProvider = serviceProvider; 29 this.ServiceProvider = serviceProvider;
@@ -380,15 +382,15 @@ namespace WixToolset.Core.CommandLine
380 382
381 foreach (var bindPath in bindPaths) 383 foreach (var bindPath in bindPaths)
382 { 384 {
383 var bp = BindPath.Parse(bindPath); 385 var bp = ParseBindPath(bindPath);
384 386
385 if (Directory.Exists(bp.Path)) 387 if (File.Exists(bp.Path))
386 { 388 {
387 result.Add(bp); 389 this.Messaging.Write(ErrorMessages.ExpectedDirectoryGotFile("-bindpath", bp.Path));
388 } 390 }
389 else if (File.Exists(bp.Path)) 391 else
390 { 392 {
391 this.Messaging.Write(ErrorMessages.ExpectedDirectoryGotFile("-bindpath", bp.Path)); 393 result.Add(bp);
392 } 394 }
393 } 395 }
394 396
@@ -407,5 +409,11 @@ namespace WixToolset.Core.CommandLine
407 409
408 return false; 410 return false;
409 } 411 }
412
413 public static BindPath ParseBindPath(string bindPath)
414 {
415 string[] namedPath = bindPath.Split(BindPathSplit, 2);
416 return (1 == namedPath.Length) ? new BindPath(namedPath[0]) : new BindPath(namedPath[0], namedPath[1]);
417 }
410 } 418 }
411} 419}