mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-18 23:50:13 +01:00
🐛 Windows 端部分系统上内核崩溃 https://github.com/siyuan-note/siyuan/issues/7806
This commit is contained in:
parent
aab3d88a7d
commit
d55af3966d
1 changed files with 16 additions and 8 deletions
|
|
@ -303,17 +303,21 @@ func existAvailabilityStatus(workspaceAbsPath string) bool {
|
||||||
// 改进 Windows 端第三方同步盘检测 https://github.com/siyuan-note/siyuan/issues/7777
|
// 改进 Windows 端第三方同步盘检测 https://github.com/siyuan-note/siyuan/issues/7777
|
||||||
|
|
||||||
defer logging.Recover()
|
defer logging.Recover()
|
||||||
ole.CoInitialize(0)
|
|
||||||
defer ole.CoUninitialize()
|
|
||||||
|
|
||||||
dataAbsPath := filepath.Join(workspaceAbsPath, "data")
|
checkAbsPath := filepath.Join(workspaceAbsPath, "data")
|
||||||
dir, file := filepath.Split(dataAbsPath)
|
if !gulu.File.IsExist(checkAbsPath) {
|
||||||
|
checkAbsPath = workspaceAbsPath
|
||||||
if !gulu.File.IsExist(dataAbsPath) {
|
}
|
||||||
dataAbsPath = workspaceAbsPath
|
if !gulu.File.IsExist(checkAbsPath) {
|
||||||
|
logging.LogWarnf("check path [%s] not exist", checkAbsPath)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logging.LogInfof("check workspace [%s] availability status", checkAbsPath)
|
||||||
|
|
||||||
|
ole.CoInitializeEx(0, ole.COINIT_MULTITHREADED)
|
||||||
|
defer ole.CoUninitialize()
|
||||||
|
dir, file := filepath.Split(checkAbsPath)
|
||||||
unknown, err := oleutil.CreateObject("Shell.Application")
|
unknown, err := oleutil.CreateObject("Shell.Application")
|
||||||
if nil != err {
|
if nil != err {
|
||||||
logging.LogWarnf("create shell application failed: %s", err)
|
logging.LogWarnf("create shell application failed: %s", err)
|
||||||
|
|
@ -339,6 +343,10 @@ func existAvailabilityStatus(workspaceAbsPath string) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
fileObj := result.ToIDispatch()
|
fileObj := result.ToIDispatch()
|
||||||
|
if nil == fileObj {
|
||||||
|
logging.LogWarnf("call shell [ParseName] file is nil [%s]", checkAbsPath)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
result, err = oleutil.CallMethod(folderObj, "GetDetailsOf", fileObj, 303)
|
result, err = oleutil.CallMethod(folderObj, "GetDetailsOf", fileObj, 303)
|
||||||
if nil != err {
|
if nil != err {
|
||||||
|
|
@ -357,7 +365,7 @@ func existAvailabilityStatus(workspaceAbsPath string) bool {
|
||||||
if strings.Contains(status, "sync") || strings.Contains(status, "同步") ||
|
if strings.Contains(status, "sync") || strings.Contains(status, "同步") ||
|
||||||
strings.Contains(status, "available on this device") || strings.Contains(status, "在此设备上可用") ||
|
strings.Contains(status, "available on this device") || strings.Contains(status, "在此设备上可用") ||
|
||||||
strings.Contains(status, "available when online") || strings.Contains(status, "联机时可用") {
|
strings.Contains(status, "available when online") || strings.Contains(status, "联机时可用") {
|
||||||
logging.LogErrorf("[%s] third party sync status [%s]", dataAbsPath, status)
|
logging.LogErrorf("[%s] third party sync status [%s]", checkAbsPath, status)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue