浏览代码

fix: unify symlink handling for site and stream on posix and win

Jacky 14 小时之前
父节点
当前提交
ab97f94356
共有 3 个文件被更改,包括 3 次插入3 次删除
  1. 1 1
      internal/self_check/resolve_path_win.go
  2. 1 1
      internal/site/disable.go
  3. 1 1
      internal/stream/disable.go

+ 1 - 1
internal/self_check/resolve_path_win.go

@@ -9,5 +9,5 @@ import "path/filepath"
 // inclde sites-enabled/*.conf
 
 func resolvePath(path ...string) string {
-	return filepath.Join(path...) + ".conf"
+	return filepath.ToSlash(filepath.Join(path...) + ".conf")
 }

+ 1 - 1
internal/site/disable.go

@@ -17,7 +17,7 @@ import (
 
 // Disable disables a site by removing the symlink in sites-enabled
 func Disable(name string) (err error) {
-	enabledConfigFilePath := nginx.GetConfPath("sites-enabled", name)
+	enabledConfigFilePath := nginx.GetConfSymlinkPath(nginx.GetConfPath("sites-enabled", name))
 	_, err = os.Stat(enabledConfigFilePath)
 	if err != nil {
 		return

+ 1 - 1
internal/stream/disable.go

@@ -17,7 +17,7 @@ import (
 
 // Disable disables a site by removing the symlink in sites-enabled
 func Disable(name string) (err error) {
-	enabledConfigFilePath := nginx.GetConfPath("streams-enabled", name)
+	enabledConfigFilePath := nginx.GetConfSymlinkPath(nginx.GetConfPath("streams-enabled", name))
 	_, err = os.Stat(enabledConfigFilePath)
 	if err != nil {
 		return