Mercurial > projects > ldc
comparison dmd2/inifile.c @ 1526:54b3c1394d62
Merged dmdfe 2.031.
author | Robert Clipsham <robert@octarineparrot.com> |
---|---|
date | Tue, 07 Jul 2009 02:26:11 +0100 |
parents | 638d16625da2 |
children |
comparison
equal
deleted
inserted
replaced
1525:d28cd7c45267 | 1526:54b3c1394d62 |
---|---|
12 | 12 |
13 #include <stdio.h> | 13 #include <stdio.h> |
14 #include <string.h> | 14 #include <string.h> |
15 #include <stdlib.h> | 15 #include <stdlib.h> |
16 #include <ctype.h> | 16 #include <ctype.h> |
17 | |
18 #if _WIN32 | |
19 #include <windows.h> | |
20 #endif | |
17 | 21 |
18 #if __APPLE__ | 22 #if __APPLE__ |
19 #include <sys/syslimits.h> | 23 #include <sys/syslimits.h> |
20 #endif | 24 #endif |
21 #if __FreeBSD__ || __sun&&__SVR4 | 25 #if __FreeBSD__ || __sun&&__SVR4 |
89 else | 93 else |
90 { | 94 { |
91 filename = FileName::combine(getenv("HOME"), inifile); | 95 filename = FileName::combine(getenv("HOME"), inifile); |
92 if (!FileName::exists(filename)) | 96 if (!FileName::exists(filename)) |
93 { | 97 { |
98 #if _WIN32 // This fix by Tim Matthews | |
99 char resolved_name[MAX_PATH + 1]; | |
100 if(GetModuleFileName(NULL, resolved_name, MAX_PATH + 1) && FileName::exists(resolved_name)) | |
101 { | |
102 filename = (char *)FileName::replaceName(resolved_name, inifile); | |
103 if(FileName::exists(filename)) | |
104 goto Ldone; | |
105 } | |
106 #endif | |
94 filename = (char *)FileName::replaceName(argv0, inifile); | 107 filename = (char *)FileName::replaceName(argv0, inifile); |
95 if (!FileName::exists(filename)) | 108 if (!FileName::exists(filename)) |
96 { | 109 { |
97 #if linux || __APPLE__ || __FreeBSD__ || __sun&&__SVR4 | 110 #if linux || __APPLE__ || __FreeBSD__ || __sun&&__SVR4 |
98 #if __GLIBC__ || __APPLE__ || __FreeBSD__ || __sun&&__SVR4 // This fix by Thomas Kuehne | 111 #if __GLIBC__ || __APPLE__ || __FreeBSD__ || __sun&&__SVR4 // This fix by Thomas Kuehne |