libpkgconf: pkg: fix computation of pkgconf_pkg_t.id on Windows.
Windows allows both \ and / as valid path characters. A computed path such as C:\development\libfoo\pkgconfig/foo.pc will result in a computed pkgconf_pkg_t.id of "pkgconfig/foo". Accordingly, correct the path normalization for checking for / after the \ path has been dealt with in all cases.pull/199/head
parent
be6b382dde
commit
0253fddc1d
|
@ -381,13 +381,18 @@ pkgconf_pkg_new_from_file(pkgconf_client_t *client, const char *filename, FILE *
|
||||||
/* make module id */
|
/* make module id */
|
||||||
if ((idptr = strrchr(pkg->filename, PKG_DIR_SEP_S)) != NULL)
|
if ((idptr = strrchr(pkg->filename, PKG_DIR_SEP_S)) != NULL)
|
||||||
idptr++;
|
idptr++;
|
||||||
#ifdef _WIN32
|
|
||||||
else if ((idptr = strrchr(pkg->filename, '/')) != NULL)
|
|
||||||
idptr++;
|
|
||||||
#endif
|
|
||||||
else
|
else
|
||||||
idptr = pkg->filename;
|
idptr = pkg->filename;
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
/* On Windows, both \ and / are allowed in paths, so we have to chop both.
|
||||||
|
* strrchr() took us to the last \ in that case, so we just have to see if
|
||||||
|
* it is followed by a /. If so, lop it off.
|
||||||
|
*/
|
||||||
|
if ((idptr = strrchr(idptr, '/')) != NULL)
|
||||||
|
idptr++;
|
||||||
|
#endif
|
||||||
|
|
||||||
pkg->id = strdup(idptr);
|
pkg->id = strdup(idptr);
|
||||||
idptr = strrchr(pkg->id, '.');
|
idptr = strrchr(pkg->id, '.');
|
||||||
if (idptr)
|
if (idptr)
|
||||||
|
|
Loading…
Reference in New Issue