Skip to content

Commit

Permalink
fix homedir handling and zip dir creation
Browse files Browse the repository at this point in the history
  • Loading branch information
bakito committed Sep 23, 2022
1 parent d3f9d8c commit 127ca61
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,9 @@ func readToolbox() (*types.Toolbox, error) {
return nil, err
}

tbFile = filepath.Join(userHomeDir, toolboxConfFile)
if _, err := os.Stat(tbFile); err != nil {
return nil, err
homePath := filepath.Join(userHomeDir, toolboxConfFile)
if _, err := os.Stat(tbFile); err == nil {
tbFile = homePath
}
}
log.Printf("Reading config %s\n", tbFile)
Expand Down
4 changes: 2 additions & 2 deletions pkg/extract/extract.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"io"
"log"
"os"
"path"
"path/filepath"
"strings"

Expand Down Expand Up @@ -59,7 +58,8 @@ func unzipFile(file *zip.File, target string) error {
if err != nil {
return err
}
_ = os.MkdirAll(path.Dir(name), os.ModeDir)
parent, _ := filepath.Split(name)
_ = os.MkdirAll(parent, os.ModeDir)
create, err := os.Create(name)
if err != nil {
return err
Expand Down

0 comments on commit 127ca61

Please sign in to comment.