forked from ariadne/pkgconf
pkg: pkg_get_parent_dir() should fall back to '/' directory separator if necessary
Some environments such as the MingW-MSYS shell environment use both \ and / as directory separators, thusly we should fall back to the POSIX directory separator. Both directory separators are fully supported by Windows.feature/tap-sh
parent
847ddbbc22
commit
3867a66434
5
pkg.c
5
pkg.c
|
@ -131,7 +131,10 @@ pkg_get_parent_dir(pkg_t *pkg)
|
|||
char *pathbuf;
|
||||
|
||||
strlcpy(buf, pkg->filename, sizeof buf);
|
||||
if ((pathbuf = strrchr(buf, PKG_DIR_SEP_S)) != NULL)
|
||||
pathbuf = strrchr(buf, PKG_DIR_SEP_S);
|
||||
if (pathbuf == NULL)
|
||||
pathbuf = strrchr(buf, '/');
|
||||
if (pathbuf != NULL)
|
||||
pathbuf[0] = '\0';
|
||||
|
||||
return buf;
|
||||
|
|
Loading…
Reference in New Issue