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 {