Skip to content

Commit

Permalink
fix: error if use abs temp path (close #1624)
Browse files Browse the repository at this point in the history
  • Loading branch information
xhofe committed Sep 9, 2022
1 parent 92fba9a commit 4af9124
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions internal/bootstrap/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,14 @@ func InitConfig() {
confFromEnv()
}
// convert abs path
var absPath string
var err error
if !filepath.IsAbs(conf.Conf.TempDir) {
absPath, err = filepath.Abs(conf.Conf.TempDir)
absPath, err := filepath.Abs(conf.Conf.TempDir)
if err != nil {
log.Fatalf("get abs path error: %+v", err)
}
conf.Conf.TempDir = absPath
}
conf.Conf.TempDir = absPath
err = os.RemoveAll(filepath.Join(conf.Conf.TempDir))
err := os.RemoveAll(filepath.Join(conf.Conf.TempDir))
if err != nil {
log.Errorln("failed delete temp file:", err)
}
Expand Down

0 comments on commit 4af9124

Please sign in to comment.