add file soft link path resolve support (#1482)

* add file soft link path resolve

* add configuration file soft link path resolve support
This commit is contained in:
Nanyu authored and GitHub committed 2023-01-03 10:52:11 -05:00
1 parent 11ec77bc76
commit eaf401eda9
2 files changed
+12 -3

No files matched your search

+6 -2
View File
@@ -3,7 +3,7 @@ package filesystem
import (
"io"
"os"
"path/filepath"
"github.com/xtls/xray-core/common/buf"
"github.com/xtls/xray-core/common/platform"
)
@@ -11,7 +11,11 @@ import (
type FileReaderFunc func(path string) (io.ReadCloser, error)
var NewFileReader FileReaderFunc = func(path string) (io.ReadCloser, error) {
return os.Open(path)
resolved_path,err:=filepath.EvalSymlinks(path)
if err!= nil{
return nil,err
}
return os.Open(resolved_path)
}
func ReadFile(path string) ([]byte, error) {