diff --git a/pkg.c b/pkg.c index c77f017..bbcbb72 100644 --- a/pkg.c +++ b/pkg.c @@ -62,6 +62,7 @@ pkg_t * pkg_find(const char *name, unsigned int flags) { char locbuf[PKG_CONFIG_PATH_SZ]; + char uninst_locbuf[PKG_CONFIG_PATH_SZ]; char **path; size_t count, iter = 0; const char *env_path; @@ -76,8 +77,17 @@ pkg_find(const char *name, unsigned int flags) while (iter < count) { snprintf(locbuf, sizeof locbuf, "%s/%s" PKG_CONFIG_EXT, path[iter], name); + snprintf(uninst_locbuf, sizeof uninst_locbuf, "%s/%s-uninstalled" PKG_CONFIG_EXT, path[iter], name); free(path[iter]); + if ((f = fopen(uninst_locbuf, "r")) != NULL) + { + pkg_t *pkg = parse_file(locbuf, f); + pkg->uninstalled = true; + + return pkg; + } + if ((f = fopen(locbuf, "r")) != NULL) return parse_file(locbuf, f); @@ -94,8 +104,17 @@ pkg_find(const char *name, unsigned int flags) while (iter < count) { snprintf(locbuf, sizeof locbuf, "%s/%s" PKG_CONFIG_EXT, path[iter], name); + snprintf(uninst_locbuf, sizeof uninst_locbuf, "%s/%s-uninstalled" PKG_CONFIG_EXT, path[iter], name); free(path[iter]); + if ((f = fopen(uninst_locbuf, "r")) != NULL) + { + pkg_t *pkg = parse_file(locbuf, f); + pkg->uninstalled = true; + + return pkg; + } + if ((f = fopen(locbuf, "r")) != NULL) return parse_file(locbuf, f); diff --git a/pkg.h b/pkg.h index a517601..d3c8cda 100644 --- a/pkg.h +++ b/pkg.h @@ -110,6 +110,8 @@ struct pkg_ { pkg_dependency_t *requires_private; pkg_dependency_t *conflicts; pkg_tuple_t *vars; + + bool uninstalled; }; #define PKG_MODULE_SEPARATOR(c) ((c) == ',' || isspace ((c)))