mirror of
https://github.com/TECHNOFAB11/jsonnet-bundler.git
synced 2025-12-12 16:10:04 +01:00
Create link for local dependencies as relative links
This commit is contained in:
parent
d78a05a86f
commit
16862329ac
1 changed files with 6 additions and 1 deletions
|
|
@ -43,6 +43,11 @@ func (p *LocalPackage) Install(ctx context.Context, name, dir, version string) (
|
|||
|
||||
oldname := filepath.Join(wd, p.Source.Directory)
|
||||
newname := filepath.Join(dir, name)
|
||||
linkname, err := filepath.Rel(dir, oldname)
|
||||
|
||||
if err != nil {
|
||||
linkname = oldname
|
||||
}
|
||||
|
||||
err = os.RemoveAll(newname)
|
||||
if err != nil {
|
||||
|
|
@ -54,7 +59,7 @@ func (p *LocalPackage) Install(ctx context.Context, name, dir, version string) (
|
|||
return "", errors.Wrap(err, "symlink destination path does not exist: %w")
|
||||
}
|
||||
|
||||
err = os.Symlink(oldname, newname)
|
||||
err = os.Symlink(linkname, newname)
|
||||
if err != nil {
|
||||
return "", errors.Wrap(err, "failed to create symlink for local dependency: %w")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue