fix path relativity

pull/3327/head
Christopher A. Stelma 8 years ago committed by Christopher A. Stelma
parent 2d66326811
commit d5ff5b4265

@ -345,7 +345,7 @@ func ensureDefaultRepos(home helmpath.Home, out io.Writer, skipRefresh bool) err
if err != nil {
return err
}
lr, err := initLocalRepo(home.LocalRepository(localRepositoryIndexFile), home.CacheIndex("local"), out)
lr, err := initLocalRepo(home.LocalRepository(localRepositoryIndexFile), home.CacheIndex("local"), out, home)
if err != nil {
return err
}
@ -383,7 +383,7 @@ func initStableRepo(cacheFile string, out io.Writer, skipRefresh bool, home helm
return &c, nil
}
func initLocalRepo(indexFile, cacheFile string, out io.Writer) (*repo.Entry, error) {
func initLocalRepo(indexFile, cacheFile string, out io.Writer, home helmpath.Home) (*repo.Entry, error) {
if fi, err := os.Stat(indexFile); err != nil {
fmt.Fprintf(out, "Adding %s repo with URL: %s \n", localRepository, localRepositoryURL)
i := repo.NewIndexFile()
@ -392,11 +392,11 @@ func initLocalRepo(indexFile, cacheFile string, out io.Writer) (*repo.Entry, err
}
//TODO: take this out and replace with helm update functionality
fp, err := filepath.Rel(indexFile, cacheFile)
fp, err := filepath.Rel(cacheFile, indexFile)
if err != nil {
return nil, err
}
pth := filepath.Join(fp)
pth := home.Path(fp)
createLink(pth, cacheFile)
} else if fi.IsDir() {
return nil, fmt.Errorf("%s must be a file, not a directory", indexFile)

Loading…
Cancel
Save