Skip to content

Commit fd1eef1

Browse files
committed
Create package directory if it doesn't exist
1 parent 37e1126 commit fd1eef1

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

v2/pkgs/tools.go

+7-4
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,13 @@ func (c *Tools) Installed(ctx context.Context) (tools.ToolCollection, error) {
7373
// Find packagers
7474
packagers, err := ioutil.ReadDir(c.Folder)
7575
if err != nil {
76-
return nil, err
76+
if !strings.Contains(err.Error(), "no such file") {
77+
return nil, err
78+
}
79+
err = os.MkdirAll(c.Folder, 0755)
80+
if err != nil {
81+
return nil, err
82+
}
7783
}
7884

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

188194
func rename(base string) extract.Renamer {
189-
fmt.Println("rename ", base)
190195
return func(path string) string {
191196
parts := strings.Split(path, string(filepath.Separator))
192197
path = strings.Join(parts[1:], string(filepath.Separator))
193198
path = filepath.Join(base, path)
194199

195-
fmt.Println(path)
196-
197200
return path
198201
}
199202
}

0 commit comments

Comments
 (0)