mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-18 22:36:10 +01:00
🎨 Warn users about potential performance issues when running on non-SSD drives https://github.com/siyuan-note/siyuan/issues/16835
Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
parent
2df2f2eb3a
commit
111ae00b1c
1 changed files with 26 additions and 14 deletions
|
|
@ -107,26 +107,32 @@ func logBootInfo() {
|
|||
logging.LogInfof("disabled features [%s]", strings.Join(DisabledFeatures, ", "))
|
||||
}
|
||||
|
||||
if gulu.OS.IsWindows() || gulu.OS.IsLinux() {
|
||||
go func() {
|
||||
if ghw.DriveTypeSSD.String() != getWorkspaceDriveType() {
|
||||
logging.LogWarnf("workspace dir [%s] is not in SSD drive, performance may be affected", WorkspaceDir)
|
||||
WaitForUILoaded()
|
||||
time.Sleep(3 * time.Second)
|
||||
PushErrMsg(Langs[Lang][278], 15000)
|
||||
}
|
||||
}()
|
||||
}
|
||||
go func() {
|
||||
if ghw.DriveTypeSSD.String() != getWorkspaceDriveType() {
|
||||
logging.LogWarnf("workspace dir [%s] is not in SSD drive, performance may be affected", WorkspaceDir)
|
||||
WaitForUILoaded()
|
||||
time.Sleep(3 * time.Second)
|
||||
PushErrMsg(Langs[Lang][278], 15000)
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
func getWorkspaceDriveType() string {
|
||||
block, err := ghw.Block()
|
||||
if err != nil {
|
||||
logging.LogWarnf("get block storage info failed: %s", err)
|
||||
return ""
|
||||
if gulu.OS.IsDarwin() {
|
||||
return ghw.DriveTypeSSD.String()
|
||||
}
|
||||
|
||||
if ContainerAndroid == Container || ContainerIOS == Container || ContainerHarmony == Container {
|
||||
return ghw.DriveTypeSSD.String()
|
||||
}
|
||||
|
||||
if gulu.OS.IsWindows() {
|
||||
block, err := ghw.Block()
|
||||
if err != nil {
|
||||
logging.LogWarnf("get block storage info failed: %s", err)
|
||||
return ""
|
||||
}
|
||||
|
||||
part := filepath.VolumeName(WorkspaceDir)
|
||||
for _, disk := range block.Disks {
|
||||
for _, partition := range disk.Partitions {
|
||||
|
|
@ -136,6 +142,12 @@ func getWorkspaceDriveType() string {
|
|||
}
|
||||
}
|
||||
} else if gulu.OS.IsLinux() {
|
||||
block, err := ghw.Block()
|
||||
if err != nil {
|
||||
logging.LogWarnf("get block storage info failed: %s", err)
|
||||
return ""
|
||||
}
|
||||
|
||||
for _, disk := range block.Disks {
|
||||
for _, partition := range disk.Partitions {
|
||||
if strings.HasPrefix(WorkspaceDir, partition.MountPoint) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue