fix: error if use abs temp path (close #1624)

pull/1628/head
Noah Hsu 2022-09-09 18:50:54 +08:00
parent 92fba9a2bf
commit 4af9124162
1 changed files with 3 additions and 5 deletions

View File

@ -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)
}