From ae59a18c8464b5074078eecb8c7ac8a51d0c1e8f Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Wed, 2 May 2012 21:24:10 +0100 Subject: Boogie: handle absolute paths on *nix correctly Specifically, if the directory separator character is '/' and an unrecognised command line parameter begins with '/', treat it as a file path rather than an option. --- Source/Core/CommandLineOptions.cs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'Source/Core/CommandLineOptions.cs') diff --git a/Source/Core/CommandLineOptions.cs b/Source/Core/CommandLineOptions.cs index 6f56f241..3e7fd79e 100644 --- a/Source/Core/CommandLineOptions.cs +++ b/Source/Core/CommandLineOptions.cs @@ -272,9 +272,9 @@ namespace Microsoft.Boogie { while (ps.i < args.Length) { cce.LoopInvariant(ps.args == args); - ps.s = args[ps.i]; - Contract.Assert(ps.s != null); - ps.s = ps.s.Trim(); + string arg = args[ps.i]; + Contract.Assert(arg != null); + ps.s = arg.Trim(); bool isOption = ps.s.StartsWith("-") || ps.s.StartsWith("/"); int colonIndex = ps.s.IndexOf(':'); @@ -290,12 +290,15 @@ namespace Microsoft.Boogie { if (isOption) { if (!ParseOption(ps.s.Substring(1), ps)) { - ps.Error("unknown switch: {0}", ps.s); + if (Path.DirectorySeparatorChar == '/' && ps.s.StartsWith("/")) + Files.Add(arg); + else + ps.Error("unknown switch: {0}", ps.s); } - } else if (ps.ConfirmArgumentCount(0)) { - string filename = ps.s; - Files.Add(filename); + } else { + Files.Add(arg); } + ps.i = ps.nextIndex; } -- cgit v1.2.3