You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2020/12/13 14:12:42 UTC

[GitHub] [dubbo-go] zouyx commented on a change in pull request #932: [Fix] file service discovery path can run in windows

zouyx commented on a change in pull request #932:
URL: https://github.com/apache/dubbo-go/pull/932#discussion_r541933318



##########
File path: config_center/file/impl.go
##########
@@ -41,13 +40,29 @@ import (
 	"github.com/apache/dubbo-go/config_center/parser"
 )
 
+var osType string
+var path string
+
 const (
-	PARAM_NAME_PREFIX                 = "dubbo.config-center."
-	CONFIG_CENTER_DIR_PARAM_NAME      = PARAM_NAME_PREFIX + "dir"
-	CONFIG_CENTER_ENCODING_PARAM_NAME = PARAM_NAME_PREFIX + "encoding"
-	DEFAULT_CONFIG_CENTER_ENCODING    = "UTF-8"
+	windows = "windows"
 )
 
+const (
+	ParamNamePrefix               = "dubbo.config-center."
+	ConfigCenterDirParamName      = ParamNamePrefix + "dir"
+	ConfigCenterEncodingParamName = ParamNamePrefix + "encoding"
+	defaultConfigCenterEncoding   = "UTF-8"
+)
+
+func init() {
+	osType = runtime.GOOS
+	if os.IsPathSeparator('\\') { //前边的判断是否是系统的分隔符

Review comment:
       In english pls

##########
File path: config_center/file/impl.go
##########
@@ -307,3 +312,57 @@ func homeWindows() (string, error) {
 
 	return home, nil
 }
+
+func mkdirIfNecessary(urlRoot string) (string, error) {
+	h := false
+	if len(urlRoot) == 0 {
+		h = true
+		goto Create

Review comment:
       why goto?

##########
File path: config_center/file/impl.go
##########
@@ -307,3 +312,57 @@ func homeWindows() (string, error) {
 
 	return home, nil
 }
+
+func mkdirIfNecessary(urlRoot string) (string, error) {
+	h := false
+	if len(urlRoot) == 0 {
+		h = true
+		goto Create
+	}
+	if _, err := os.Stat(urlRoot); err != nil {
+		h = true
+		goto Create

Review comment:
       as above




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org