Mercurial > projects > ldc
comparison dmd/inifile.c @ 35:3cfcb944304e trunk
[svn r39] * Updated to DMD 1.022 with the exception of:
Bugzilla 278: dmd.conf search path doesn't work
This fix was causing crashes for me :/ So for it's the old behaviour
author | lindquist |
---|---|
date | Tue, 09 Oct 2007 06:21:30 +0200 |
parents | c53b6e3fe49a |
children | 297690b5d4a5 |
comparison
equal
deleted
inserted
replaced
34:4648206ca213 | 35:3cfcb944304e |
---|---|
74 { | 74 { |
75 filename = FileName::replaceName(argv0, inifile); | 75 filename = FileName::replaceName(argv0, inifile); |
76 if (!FileName::exists(filename)) | 76 if (!FileName::exists(filename)) |
77 { | 77 { |
78 #if linux | 78 #if linux |
79 | |
80 #if 0 | |
81 #if __GLIBC__ // This fix by Thomas Kuehne | |
82 /* argv0 might be a symbolic link, | |
83 * so try again looking past it to the real path | |
84 */ | |
85 char* real_argv0 = realpath(argv0, NULL); | |
86 if (real_argv0) | |
87 { | |
88 filename = FileName::replaceName(real_argv0, inifile); | |
89 free(real_argv0); | |
90 if (FileName::exists(filename)) | |
91 goto Ldone; | |
92 } | |
93 #else | |
94 #error use of glibc non-standard extension realpath(char*, NULL) | |
95 #endif | |
96 #endif | |
97 | |
98 // old way; problem is that argv0 might not be on the PATH at all | |
99 // and some other instance might be found | |
100 | |
79 // Search PATH for argv0 | 101 // Search PATH for argv0 |
80 const char *p = getenv("PATH"); | 102 const char *p = getenv("PATH"); |
81 Array *paths = FileName::splitPath(p); | 103 Array *paths = FileName::splitPath(p); |
82 filename = FileName::searchPath(paths, argv0, 0); | 104 filename = FileName::searchPath(paths, argv0, 0); |
83 if (!filename) | 105 if (!filename) |