diff --git a/kernel/go.mod b/kernel/go.mod index 5d8754d2c..702745408 100644 --- a/kernel/go.mod +++ b/kernel/go.mod @@ -49,7 +49,7 @@ require ( github.com/siyuan-note/eventbus v0.0.0-20230216103454-41885eac6c2b github.com/siyuan-note/filelock v0.0.0-20230321113304-79a32917cc9f github.com/siyuan-note/httpclient v0.0.0-20230309131049-f703795de6bc - github.com/siyuan-note/logging v0.0.0-20230327034340-a7bed1fff2fe + github.com/siyuan-note/logging v0.0.0-20230327073243-ebe83aec1493 github.com/siyuan-note/riff v0.0.0-20230224144841-cfbe0748ddb7 github.com/steambap/captcha v1.4.1 github.com/studio-b12/gowebdav v0.0.0-20230203202212-3282f94193f2 diff --git a/kernel/go.sum b/kernel/go.sum index 5adb37152..6aeab2639 100644 --- a/kernel/go.sum +++ b/kernel/go.sum @@ -289,6 +289,8 @@ github.com/siyuan-note/httpclient v0.0.0-20230309131049-f703795de6bc h1:MX2cPWpn github.com/siyuan-note/httpclient v0.0.0-20230309131049-f703795de6bc/go.mod h1:WDO42mUVRnkk8M4AhZ4oakZ5jnghulP0c8NFCrrFWG4= github.com/siyuan-note/logging v0.0.0-20230327034340-a7bed1fff2fe h1:QmBB+8HVbjxXzVUdAiysYaClEAaREcxeZt6kvHcrFUc= github.com/siyuan-note/logging v0.0.0-20230327034340-a7bed1fff2fe/go.mod h1:6mRFtAAvYPn3cDzqvyv+t8BVPGqpONDMMb5ywOhY1D4= +github.com/siyuan-note/logging v0.0.0-20230327073243-ebe83aec1493 h1:oaN5b0WDFkjdBgGxmmBnMrtZxaJ76LZLwhQSZnznJMI= +github.com/siyuan-note/logging v0.0.0-20230327073243-ebe83aec1493/go.mod h1:6mRFtAAvYPn3cDzqvyv+t8BVPGqpONDMMb5ywOhY1D4= github.com/siyuan-note/riff v0.0.0-20230224144841-cfbe0748ddb7 h1:Kr8hhMhr6v+U24TMDCP5WdP4dWrXm5maar+TycTZs9I= github.com/siyuan-note/riff v0.0.0-20230224144841-cfbe0748ddb7/go.mod h1:XJtLlKCr8cZE+lzykM4edHHih92M9M50UNw/nDLYRN8= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= diff --git a/kernel/util/runtime.go b/kernel/util/runtime.go index e15ccda3b..2e3b738b8 100644 --- a/kernel/util/runtime.go +++ b/kernel/util/runtime.go @@ -323,9 +323,27 @@ func existAvailabilityStatus(workspaceAbsPath string) bool { return false } defer shell.Release() - folderObj := oleutil.MustCallMethod(shell, "NameSpace", dir).ToIDispatch() - fileObj := oleutil.MustCallMethod(folderObj, "ParseName", file).ToIDispatch() - value := oleutil.MustCallMethod(folderObj, "GetDetailsOf", fileObj, 303) + + result, err := oleutil.CallMethod(shell, "NameSpace", dir) + if nil != err { + logging.LogWarnf("call shell [NameSpace] failed: %s", err) + return false + } + folderObj := result.ToIDispatch() + + result = oleutil.MustCallMethod(folderObj, "ParseName", file) + if nil != err { + logging.LogWarnf("call shell [ParseName] failed: %s", err) + return false + } + fileObj := result.ToIDispatch() + + result, err = oleutil.CallMethod(folderObj, "GetDetailsOf", fileObj, 303) + if nil != err { + logging.LogWarnf("call shell [GetDetailsOf] failed: %s", err) + return false + } + value := result if nil == value { return false }