comparison dmd/mars.c @ 432:ecf70fe065b9

fixed configuration file loading issues on windows
author elrood
date Tue, 29 Jul 2008 21:52:25 +0200
parents 1f20b9f7de1b
children 47b64d06eb9f
comparison
equal deleted inserted replaced
431:3dd9ae9ea708 432:ecf70fe065b9
19 #include <dos.h> 19 #include <dos.h>
20 #endif 20 #endif
21 21
22 #if linux 22 #if linux
23 #include <errno.h> 23 #include <errno.h>
24 #elif _WIN32
25 #include <windows.h>
24 #endif 26 #endif
25 27
26 #include "mem.h" 28 #include "mem.h"
27 #include "root.h" 29 #include "root.h"
28 30
254 #endif 256 #endif
255 257
256 files.reserve(argc - 1); 258 files.reserve(argc - 1);
257 259
258 // Set default values 260 // Set default values
261 #if _WIN32
262 char buf[MAX_PATH];
263 GetModuleFileName(NULL, buf, MAX_PATH);
264 global.params.argv0 = buf;
265 #else
259 global.params.argv0 = argv[0]; 266 global.params.argv0 = argv[0];
267 #endif
260 global.params.link = 1; 268 global.params.link = 1;
261 global.params.useAssert = 0; 269 global.params.useAssert = 0;
262 global.params.useInvariants = 1; 270 global.params.useInvariants = 1;
263 global.params.useIn = 1; 271 global.params.useIn = 1;
264 global.params.useOut = 1; 272 global.params.useOut = 1;
324 332
325 //VersionCondition::addPredefinedGlobalIdent("D_Bits"); 333 //VersionCondition::addPredefinedGlobalIdent("D_Bits");
326 VersionCondition::addPredefinedGlobalIdent("all"); 334 VersionCondition::addPredefinedGlobalIdent("all");
327 335
328 #if _WIN32 336 #if _WIN32
329 inifile(argv[0], "llvmdc.ini"); 337 inifile(global.params.argv0, "llvmdc.ini");
330 #elif linux 338 #elif linux
331 inifile(argv[0], "llvmdc.conf"); 339 inifile(global.params.argv0, "llvmdc.conf");
332 #else 340 #else
333 #error 341 #error
334 #endif 342 #endif
335 getenv_setargv("DFLAGS", &argc, &argv); 343 getenv_setargv("DFLAGS", &argc, &argv);
336 344
1063 } 1071 }
1064 else 1072 else
1065 { 1073 {
1066 if (global.params.link) 1074 if (global.params.link)
1067 //status = runLINK(); 1075 //status = runLINK();
1068 linkExecutable(argv[0]); 1076 linkExecutable(global.params.argv0);
1069 1077
1070 if (global.params.run) 1078 if (global.params.run)
1071 { 1079 {
1072 if (!status) 1080 if (!status)
1073 { 1081 {