From 262df042d604476a0628c41c9f894fd04feccd0c Mon Sep 17 00:00:00 2001 From: sof Date: Wed, 1 Aug 2001 21:55:04 +0000 Subject: [PATCH] [project @ 2001-08-01 21:55:04 by sof] Support LFNs --- ghc/driver/ghci/ghci.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/ghc/driver/ghci/ghci.c b/ghc/driver/ghci/ghci.c index bd75ac3..a9f79de 100644 --- a/ghc/driver/ghci/ghci.c +++ b/ghc/driver/ghci/ghci.c @@ -1,6 +1,6 @@ /* * - * $Id: ghci.c,v 1.1 2001/07/30 10:40:36 rrt Exp $ + * $Id: ghci.c,v 1.2 2001/08/01 21:55:04 sof Exp $ * * ghci wrapper - invokes ghc.exe with the added command-line * option "--interactive". @@ -39,6 +39,7 @@ #include #include #include +#include #define BINARY_NAME "ghc.exe" #define IACTIVE_OPTION "--interactive" @@ -49,19 +50,20 @@ int main(int argc, char** argv) { TCHAR binPath[FILENAME_MAX+1]; + TCHAR binPathShort[MAX_PATH+1]; DWORD dwSize = FILENAME_MAX; DWORD dwRes; TCHAR* szEnd; char** new_argv; int i; - + /* Locate the binary we want to start up */ dwRes = SearchPath(NULL, BINARY_NAME, NULL, dwSize, - binPath, + (char*)binPath, &szEnd); if (dwRes == 0) { @@ -69,12 +71,20 @@ main(int argc, char** argv) return 1; } + dwSize = MAX_PATH; + /* Turn the path into short form - LFN form causes problems + when passed in argv[0]. */ + if ( !(GetShortPathName(binPath, binPathShort, dwSize)) ) { + errmsg("Unable to locate ghc.exe"); + return 1; + } + new_argv = (char**)malloc(sizeof(char) * (argc + 1 + 1)); if (new_argv == NULL) { errmsg("failed to start up ghc.exe"); return 1; } - new_argv[0] = binPath; + new_argv[0] = binPathShort; new_argv[1] = (char*)malloc(sizeof(char) * (strlen(IACTIVE_OPTION) + 1)); if (new_argv[1]) { -- 1.7.10.4