Skip to content

Commit

Permalink
update relPath
Browse files Browse the repository at this point in the history
  • Loading branch information
WillAbides committed Dec 9, 2023
1 parent 4f74a92 commit 6061904
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion internal/bindown/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,11 @@ func createBindownWrapper(target, cacheDir, tag, baseURL string) (string, error)
// relPath returns target relative to base and converted to slash-separated path.
// Unlike filepath.Rel, it converts both paths to absolute paths before calculating the relative path.
func relPath(base, target string) (string, error) {
// if it works without abs, use that
rel, err := filepath.Rel(base, target)
if err == nil {
return filepath.ToSlash(rel), nil
}
absBase, err := filepath.Abs(base)
if err != nil {
return "", err
Expand All @@ -221,7 +226,7 @@ func relPath(base, target string) (string, error) {
if err != nil {
return "", err
}
rel, err := filepath.Rel(absBase, absTarget)
rel, err = filepath.Rel(absBase, absTarget)
if err != nil {
return "", err
}
Expand Down

0 comments on commit 6061904

Please sign in to comment.