Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Create package directory if it doesn't exist
  • Loading branch information
matteosuppo committed Mar 29, 2019
commit fd1eef1bc0c7e9e200f639d58ecd9c456421ef03
11 changes: 7 additions & 4 deletions v2/pkgs/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,13 @@ func (c *Tools) Installed(ctx context.Context) (tools.ToolCollection, error) {
// Find packagers
packagers, err := ioutil.ReadDir(c.Folder)
if err != nil {
return nil, err
if !strings.Contains(err.Error(), "no such file") {
return nil, err
}
err = os.MkdirAll(c.Folder, 0755)
if err != nil {
return nil, err
}
}

for _, packager := range packagers {
Expand Down Expand Up @@ -186,14 +192,11 @@ func (c *Tools) Remove(ctx context.Context, payload *tools.ToolPayload) error {
}

func rename(base string) extract.Renamer {
fmt.Println("rename ", base)
return func(path string) string {
parts := strings.Split(path, string(filepath.Separator))
path = strings.Join(parts[1:], string(filepath.Separator))
path = filepath.Join(base, path)

fmt.Println(path)

return path
}
}
Expand Down