Skip to content

Commit

Permalink
解压时加入过程动画
Browse files Browse the repository at this point in the history
  • Loading branch information
Jrohy committed Jan 25, 2022
1 parent d0e3cde commit 864ff10
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func updateProcess(diList []*downloadInfo, stopCh chan struct{}) {
}

func updateCfw(diList []*downloadInfo) {
var stopCh chan struct{}
stopCh := make(chan struct{})
if updateCore || updateTrans {
stopCh = make(chan struct{})
go showProgress("更新cfw中", stopCh)
Expand Down
10 changes: 9 additions & 1 deletion utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,19 +176,27 @@ func recentlyTag(url string) []string {
}

func extract7z(name string) {
fmt.Println(fmt.Sprintf("解压%s中..", name))
stopCh := make(chan struct{})
closeChan := func() {
close(stopCh)
fmt.Println("")
}
go showProgress(fmt.Sprintf("解压%s中", name), stopCh)
extractPath := fullPath(strings.TrimSuffix(name, path.Ext(name)))
if !IsExists(extractPath) {
a, err := unarr.NewArchive(fullPath(name))
if err != nil {
closeChan()
exit(err.Error())
}
defer a.Close()
_, err = a.Extract(extractPath)
if err != nil {
closeChan()
exit(err.Error())
}
}
closeChan()
}

func getExeVersion(exePath string) string {
Expand Down

0 comments on commit 864ff10

Please sign in to comment.