summaryrefslogtreecommitdiff
path: root/Source/DafnyExtension/DafnyDriver.cs
diff options
context:
space:
mode:
authorGravatar chrishaw <unknown>2015-03-11 16:36:04 -0700
committerGravatar chrishaw <unknown>2015-03-11 16:36:04 -0700
commitb7c29f98817a2efe26b8a120802250c5bc4f26e3 (patch)
treec27c99200f346e787599c718fe1b51944230c2ad /Source/DafnyExtension/DafnyDriver.cs
parent43b34f8dbbfa2bdc1c0e0f09f8670e2d1c3051fb (diff)
Add DafnyOptions.txt, and have the Dafny Visual Studio extension read command-line options from DafnyOptions.txt during initialization. DafnyOptions.txt gets built into the VSIX file and is installed as part of the Dafny Visual Studio extension.
Diffstat (limited to 'Source/DafnyExtension/DafnyDriver.cs')
-rw-r--r--Source/DafnyExtension/DafnyDriver.cs20
1 files changed, 19 insertions, 1 deletions
diff --git a/Source/DafnyExtension/DafnyDriver.cs b/Source/DafnyExtension/DafnyDriver.cs
index 5dd6d8ab..5b8cc943 100644
--- a/Source/DafnyExtension/DafnyDriver.cs
+++ b/Source/DafnyExtension/DafnyDriver.cs
@@ -41,7 +41,25 @@ namespace DafnyLanguage
options.VcsCores = Math.Max(1, System.Environment.ProcessorCount - 1);
options.ModelViewFile = "-";
Dafny.DafnyOptions.Install(options);
- options.ApplyDefaultOptions();
+
+ // Read additional options from DafnyOptions.txt
+ string codebase = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
+ string optionsFilePath = Path.Combine(codebase, "DafnyOptions.txt");
+ if (File.Exists(optionsFilePath)) {
+ var optionsReader = new StreamReader(new FileStream(optionsFilePath, FileMode.Open, FileAccess.Read));
+ List<string> args = new List<string>();
+ while (true) {
+ string line = optionsReader.ReadLine();
+ if (line == null) break;
+ line = line.Trim();
+ if (line.Length == 0 || line.StartsWith("//")) continue;
+ args.Add(line);
+ }
+ optionsReader.Close();
+ CommandLineOptions.Clo.Parse(args.ToArray());
+ } else {
+ options.ApplyDefaultOptions();
+ }
ExecutionEngine.printer = new DummyPrinter();
ExecutionEngine.errorInformationFactory = new DafnyErrorInformationFactory();