Skip to content

Commit

Permalink
Merge pull request #7 from foomo/fix/absolute-target
Browse files Browse the repository at this point in the history
fix: absolute paths
  • Loading branch information
franklinkim authored Dec 20, 2024
2 parents 8b6e2b0 + 48e6edc commit 4aeb3a3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export PATH := bin:$(PATH)

.PHONY: brew
## Install project binaries
brew:
brew: install
@ownbrew install

.PHONY: doc
Expand Down
7 changes: 3 additions & 4 deletions pkg/ownbrew/ownbrew.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,10 @@ func (o *Ownbrew) symlink(source, target string) error {
return err
}

prefix, err := filepath.Rel(filepath.Base(target), "")
if err != nil {
return err
var prefix string
if value, err := filepath.Rel(filepath.Base(target), source); err == nil {
prefix = strings.TrimSuffix(value, ".")
}
prefix = strings.TrimSuffix(prefix, ".")

o.l.Debug("symlink:", prefix+source, target)
return os.Symlink(prefix+source, target)
Expand Down

0 comments on commit 4aeb3a3

Please sign in to comment.