forked from ariadne/pkgconf
pkg: add support for relative path finding on windows (issue #17)
parent
6519f6abdc
commit
524133cd91
21
pkg.c
21
pkg.c
|
@ -92,11 +92,32 @@ static inline const char *
|
|||
get_pkgconfig_path(void)
|
||||
{
|
||||
const char *env_path;
|
||||
#ifdef _WIN32
|
||||
static char outbuf[MAX_PATH];
|
||||
char namebuf[MAX_PATH];
|
||||
char *p;
|
||||
#endif
|
||||
|
||||
env_path = getenv("PKG_CONFIG_LIBDIR");
|
||||
if (env_path != NULL)
|
||||
return env_path;
|
||||
|
||||
#ifdef _WIN32
|
||||
GetModuleFileName(NULL, namebuf, sizeof namebuf);
|
||||
|
||||
p = strrchr(namebuf, '\\');
|
||||
if (p == NULL)
|
||||
p = strrchr(namebuf, '/');
|
||||
if (p == NULL)
|
||||
return PKG_DEFAULT_PATH;
|
||||
|
||||
*p = '\0';
|
||||
strlcpy(outbuf, namebuf, sizeof outbuf);
|
||||
strlcat(outbuf, "/lib/pkgconfig", sizeof outbuf);
|
||||
|
||||
return outbuf;
|
||||
#endif
|
||||
|
||||
return PKG_DEFAULT_PATH;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue