瀏覽代碼

:art: 启动进度详情中加入版本信息

Liang Ding 3 年之前
父節點
當前提交
1275a4bf16
共有 2 個文件被更改,包括 13 次插入8 次删除
  1. 6 5
      kernel/model/repository.go
  2. 7 3
      kernel/util/working.go

+ 6 - 5
kernel/model/repository.go

@@ -24,6 +24,7 @@ import (
 	"fmt"
 	"math"
 	"os"
+	"path/filepath"
 	"strings"
 	"time"
 
@@ -637,7 +638,7 @@ func subscribeEvents() {
 
 	indexWalkDataCount := 0
 	eventbus.Subscribe(dejavu.EvtIndexWalkData, func(context map[string]interface{}, path string) {
-		msg := fmt.Sprintf(Conf.Language(158), path)
+		msg := fmt.Sprintf(Conf.Language(158), filepath.Base(path))
 		if 0 == indexWalkDataCount%512 {
 			util.SetBootDetails(msg)
 			contextPushMsg(context, msg)
@@ -665,7 +666,7 @@ func subscribeEvents() {
 	})
 	indexUpsertFileCount := 0
 	eventbus.Subscribe(dejavu.EvtIndexUpsertFile, func(context map[string]interface{}, path string) {
-		msg := fmt.Sprintf(Conf.Language(160), path)
+		msg := fmt.Sprintf(Conf.Language(160), filepath.Base(path))
 		if 0 == indexUpsertFileCount%128 {
 			util.SetBootDetails(msg)
 			contextPushMsg(context, msg)
@@ -680,7 +681,7 @@ func subscribeEvents() {
 	})
 	coWalkDataCount := 0
 	eventbus.Subscribe(dejavu.EvtCheckoutWalkData, func(context map[string]interface{}, path string) {
-		msg := fmt.Sprintf(Conf.Language(161), path)
+		msg := fmt.Sprintf(Conf.Language(161), filepath.Base(path))
 		if 0 == coWalkDataCount%512 {
 			util.SetBootDetails(msg)
 			contextPushMsg(context, msg)
@@ -696,7 +697,7 @@ func subscribeEvents() {
 	})
 	coUpsertFileCount := 0
 	eventbus.Subscribe(dejavu.EvtCheckoutUpsertFile, func(context map[string]interface{}, path string) {
-		msg := fmt.Sprintf(Conf.Language(162), path)
+		msg := fmt.Sprintf(Conf.Language(162), filepath.Base(path))
 		util.IncBootProgress(bootProgressPart, msg)
 		if 0 == coUpsertFileCount%128 {
 			contextPushMsg(context, msg)
@@ -711,7 +712,7 @@ func subscribeEvents() {
 	})
 	coRemoveFileCount := 0
 	eventbus.Subscribe(dejavu.EvtCheckoutRemoveFile, func(context map[string]interface{}, path string) {
-		msg := fmt.Sprintf(Conf.Language(163), path)
+		msg := fmt.Sprintf(Conf.Language(163), filepath.Base(path))
 		util.IncBootProgress(bootProgressPart, msg)
 		if 0 == coRemoveFileCount%512 {
 			contextPushMsg(context, msg)

+ 7 - 3
kernel/util/working.go

@@ -110,11 +110,15 @@ func Boot() {
 	go cleanOld()
 }
 
+func setBootDetails(details string) {
+	bootDetails = "v" + Ver + " " + details
+}
+
 func SetBootDetails(details string) {
 	if 100 <= bootProgress {
 		return
 	}
-	bootDetails = details
+	setBootDetails(details)
 }
 
 func IncBootProgress(progress float64, details string) {
@@ -122,7 +126,7 @@ func IncBootProgress(progress float64, details string) {
 		return
 	}
 	bootProgress += progress
-	bootDetails = details
+	setBootDetails(details)
 }
 
 func IsBooted() bool {
@@ -138,7 +142,7 @@ func GetBootProgress() float64 {
 }
 
 func SetBooted() {
-	bootDetails = "Finishing boot..."
+	setBootDetails("Finishing boot...")
 	bootProgress = 100
 	logging.LogInfof("kernel booted")
 }