From 08641595ae072679ea7f31182104f334d4601335 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Fri, 10 Feb 2023 21:45:21 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E8=AE=B0=E5=BD=95=E6=93=8D=E4=BD=9C?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E5=B9=B3=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/model/conf.go | 2 +- kernel/util/os.go | 6 +++--- kernel/util/os_mobile.go | 8 ++++---- kernel/util/runtime.go | 7 ++++++- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/kernel/model/conf.go b/kernel/model/conf.go index 195cb6f6e..722d61040 100644 --- a/kernel/model/conf.go +++ b/kernel/model/conf.go @@ -236,7 +236,7 @@ func InitConf() { logging.LogInfof("using Microsoft Store edition") } Conf.System.OS = runtime.GOOS - Conf.System.OSPlatform = util.GetOSPlatform() + Conf.System.OSPlatform, _ = util.GetOSPlatform() Conf.Newbie = util.IsNewbie if "" != Conf.UserData { diff --git a/kernel/util/os.go b/kernel/util/os.go index b133b9b7c..77063519a 100644 --- a/kernel/util/os.go +++ b/kernel/util/os.go @@ -23,11 +23,11 @@ import ( "github.com/siyuan-note/logging" ) -func GetOSPlatform() (ret string) { - ret, _, _, err := host.PlatformInformation() +func GetOSPlatform() (plat, ver string) { + plat, _, ver, err := host.PlatformInformation() if nil != err { logging.LogWarnf("get os platform failed: %s", err) - return "Unknown" + return "Unknown", "" } return } diff --git a/kernel/util/os_mobile.go b/kernel/util/os_mobile.go index 0fd367d4d..dc48ac4b1 100644 --- a/kernel/util/os_mobile.go +++ b/kernel/util/os_mobile.go @@ -18,12 +18,12 @@ package util -func GetOSPlatform() (ret string) { +func GetOSPlatform() (plat, ver string) { if ContainerIOS == Container { - return "iOS" + return "iOS", "" } if ContainerAndroid == Container { - return "Android" + return "Android", "" } - return "Unknown" + return "Unknown", "" } diff --git a/kernel/util/runtime.go b/kernel/util/runtime.go index 0bcae5562..6ebea7786 100644 --- a/kernel/util/runtime.go +++ b/kernel/util/runtime.go @@ -46,6 +46,11 @@ const ( var IsExiting = false func logBootInfo() { + plat, platVer := GetOSPlatform() + osInfo := plat + if "" != platVer { + osInfo += "/" + platVer + } logging.LogInfof("kernel is booting:\n"+ " * ver [%s]\n"+ " * arch [%s]\n"+ @@ -57,7 +62,7 @@ func logBootInfo() { " * container [%s]\n"+ " * database [ver=%s]\n"+ " * workspace directory [%s]", - Ver, runtime.GOARCH, GetOSPlatform(), os.Getpid(), Mode, WorkingDir, ReadOnly, Container, DatabaseVer, WorkspaceDir) + Ver, runtime.GOARCH, osInfo, os.Getpid(), Mode, WorkingDir, ReadOnly, Container, DatabaseVer, WorkspaceDir) } func IsMutexLocked(m *sync.Mutex) bool {