summaryrefslogtreecommitdiff
path: root/Source/Core/CommandLineOptions.cs
diff options
context:
space:
mode:
authorGravatar Peter Collingbourne <peter@pcc.me.uk>2012-05-02 21:24:10 +0100
committerGravatar Peter Collingbourne <peter@pcc.me.uk>2012-05-02 21:24:10 +0100
commitae59a18c8464b5074078eecb8c7ac8a51d0c1e8f (patch)
tree296cd3bf43826932ae4628db47b642a6dedabe76 /Source/Core/CommandLineOptions.cs
parentc8da02f7bf7fcce918117d5a507360fab1bbd2d7 (diff)
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.
Diffstat (limited to 'Source/Core/CommandLineOptions.cs')
-rw-r--r--Source/Core/CommandLineOptions.cs17
1 files changed, 10 insertions, 7 deletions
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;
}