Commit f01eb541 authored by Ryan Scott's avatar Ryan Scott Committed by Ben Gamari

Fall back on ghc-stage2 when using Windows' GHCi driver

Reviewers: austin, hvr, bgamari, thomie

Reviewed By: thomie

Differential Revision: https://phabricator.haskell.org/D1721
parent 7861a225
......@@ -3,6 +3,12 @@
#include "getLocation.h"
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
BOOL fileExists(const char *path) {
const DWORD r = GetFileAttributesA(path);
return r != INVALID_FILE_ATTRIBUTES && !(r & FILE_ATTRIBUTE_DIRECTORY);
}
int main(int argc, char** argv) {
char *binDir;
......@@ -19,6 +25,13 @@ int main(int argc, char** argv) {
exePath = mkString("%s/ghc.exe", binDir);
preArgv[0] = "--interactive";
/* If ghc.exe can't be found, we assume that we're building ghc from
* source, in which case we fall back on ghc-stage2.
*/
if (!fileExists(exePath)) {
exePath = mkString("%s/ghc-stage2.exe", binDir);
}
run(exePath, 1, preArgv, argc - 1, argv + 1);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment