From 749d6133a18be10e4e18c38477a6692f4f5ef8bd Mon Sep 17 00:00:00 2001 From: R cqls Date: Sat, 23 Jan 2021 12:09:53 +0100 Subject: [PATCH] v.pkgconfig: handle paths to local .pc files too (needed for homebrew) (#8290) --- vlib/v/pkgconfig/pkgconfig.v | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/vlib/v/pkgconfig/pkgconfig.v b/vlib/v/pkgconfig/pkgconfig.v index 52b10249b3..e7ee6ba166 100644 --- a/vlib/v/pkgconfig/pkgconfig.v +++ b/vlib/v/pkgconfig/pkgconfig.v @@ -136,13 +136,19 @@ fn (mut pc PkgConfig) parse(file string) bool { } fn (mut pc PkgConfig) resolve(pkgname string) ?string { - if pc.paths.len == 0 { - pc.paths << '.' - } - for path in pc.paths { - file := '$path/${pkgname}.pc' - if os.exists(file) { - return file + if pkgname.ends_with('.pc') { + if os.exists(pkgname) { + return pkgname + } + } else { + if pc.paths.len == 0 { + pc.paths << '.' + } + for path in pc.paths { + file := '$path/${pkgname}.pc' + if os.exists(file) { + return file + } } } return error('Cannot find "$pkgname" pkgconfig file')