Fix expanding PKG_DEFAULT_PATH under Windows.
parent
bff5f15d0a
commit
39e3fc1c46
19
pkg.c
19
pkg.c
|
@ -19,7 +19,7 @@
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
# define PKG_CONFIG_REG_KEY "Software\\pkgconfig\\PKG_CONFIG_PATH"
|
# define PKG_CONFIG_REG_KEY "Software\\pkgconfig\\PKG_CONFIG_PATH"
|
||||||
# undef PKG_DEFAULT_PATH
|
# undef PKG_DEFAULT_PATH
|
||||||
# define PKG_DEFAULT_PATH "../lib/pkgconfig:../share/pkgconfig"
|
# define PKG_DEFAULT_PATH "../lib/pkgconfig;../share/pkgconfig"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define PKG_CONFIG_EXT ".pc"
|
#define PKG_CONFIG_EXT ".pc"
|
||||||
|
@ -116,19 +116,24 @@ get_pkgconfig_path(void)
|
||||||
return env_path;
|
return env_path;
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
GetModuleFileName(NULL, namebuf, sizeof namebuf);
|
int sizepath = GetModuleFileName(NULL, namebuf, sizeof namebuf);
|
||||||
|
char * winslash;
|
||||||
p = strrchr(namebuf, '\\');
|
namebuf[sizepath] = '\0';
|
||||||
if (p == NULL)
|
while ((winslash = strchr (namebuf, '\\')) != NULL)
|
||||||
p = strrchr(namebuf, '/');
|
{
|
||||||
|
*winslash = '/';
|
||||||
|
}
|
||||||
|
p = strrchr(namebuf, '/');
|
||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
return PKG_DEFAULT_PATH;
|
return PKG_DEFAULT_PATH;
|
||||||
|
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
strlcpy(outbuf, namebuf, sizeof outbuf);
|
strlcpy(outbuf, namebuf, sizeof outbuf);
|
||||||
|
strlcat(outbuf, "/", sizeof outbuf);
|
||||||
strlcat(outbuf, "../lib/pkgconfig", sizeof outbuf);
|
strlcat(outbuf, "../lib/pkgconfig", sizeof outbuf);
|
||||||
strlcat(outbuf, ":", sizeof outbuf);
|
strlcat(outbuf, ";", sizeof outbuf);
|
||||||
strlcat(outbuf, namebuf, sizeof outbuf);
|
strlcat(outbuf, namebuf, sizeof outbuf);
|
||||||
|
strlcat(outbuf, "/", sizeof outbuf);
|
||||||
strlcat(outbuf, "../share/pkgconfig", sizeof outbuf);
|
strlcat(outbuf, "../share/pkgconfig", sizeof outbuf);
|
||||||
|
|
||||||
return outbuf;
|
return outbuf;
|
||||||
|
|
Loading…
Reference in New Issue