🐛 Compat with old bazaar pkg

This commit is contained in:
Liang Ding 2023-05-08 12:00:32 +08:00
parent 4312e46d27
commit 397683d567
No known key found for this signature in database
GPG key ID: 136F30F901A2231D

View file

@ -576,14 +576,13 @@ func installPackage(data []byte, installPath string) (err error) {
return
}
dirName := filepath.Base(installPath)
dirs, err := os.ReadDir(unzipPath)
if nil != err {
return
}
srcPath := unzipPath
if 1 == len(dirs) && dirs[0].IsDir() && strings.HasPrefix(dirs[0].Name(), dirName+"-") {
if 1 == len(dirs) && dirs[0].IsDir() {
srcPath = filepath.Join(unzipPath, dirs[0].Name())
}