Skip to content
This repository has been archived by the owner on May 18, 2024. It is now read-only.

Commit

Permalink
isPublicFrom: support relative path
Browse files Browse the repository at this point in the history
  • Loading branch information
xushiwei committed Jul 20, 2022
1 parent 019f67c commit 06aa42d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions cl/pkginfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ func canPub(name string) bool {

func isPublicFrom(f string, pubFrom []string) bool {
for _, from := range pubFrom {
if strings.HasPrefix(from, ".") { // relative path
from = strings.TrimLeft(from, "./") // remove "./", "../", etc.
}
if strings.HasSuffix(f, from) {
return true
}
Expand Down
5 changes: 4 additions & 1 deletion testdata/libc/c2go.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"public": {
"from": ["size_t.h"]
"from": [
"size_t.h",
"./src/foo.h"
]
},
"target": {
"name": "libc",
Expand Down
1 change: 0 additions & 1 deletion testdata/libc/c2go.pub
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ __builtin_bswap64
printf
strlen
qsort QSort
foo

0 comments on commit 06aa42d

Please sign in to comment.