Platform: Consolidate regular file resolution

Reuse ResolveRegularFile for Lua loading/signing, local config, and assets.
Only evaluate file symlinks when needed, tolerating junction-related
resolution failures on a best-effort basis.
This commit is contained in:
Meo597
2026-10-25 23:52:22 +08:00
parent 1b1647cd9d
commit 20d107a28a
4 changed files with 41 additions and 47 deletions
+2 -5
View File
@@ -14,6 +14,7 @@ import (
"github.com/xtls/xray-core/common/buf"
"github.com/xtls/xray-core/common/errors"
"github.com/xtls/xray-core/common/platform"
"github.com/xtls/xray-core/common/utils"
"github.com/xtls/xray-core/main/commands/base"
"github.com/xtls/xray-core/main/confloader"
@@ -58,11 +59,7 @@ func readConfigFile(file *os.File) ([]byte, error) {
return nil, err
}
if info.Mode().IsRegular() {
path, err := filepath.Abs(file.Name())
if err != nil {
return nil, err
}
path, err = filepath.EvalSymlinks(path)
path, _, err := platform.ResolveRegularFile(file.Name())
if err != nil {
return nil, err
}