Kaynağa Gözat

:art: 改进 Windows 端第三方同步盘检测 Fix https://github.com/siyuan-note/siyuan/issues/7777

Liang Ding 2 yıl önce
ebeveyn
işleme
25c2901eda
3 değiştirilmiş dosya ile 24 ekleme ve 4 silme
  1. 1 1
      kernel/go.mod
  2. 2 0
      kernel/go.sum
  3. 21 3
      kernel/util/runtime.go

+ 1 - 1
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

+ 2 - 0
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=

+ 21 - 3
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
 	}