temporary fix: @consumer need resolution

This commit is contained in:
Hiddify
2024-01-26 02:18:21 +01:00
parent 2bb999ae21
commit 0d11680691
4 changed files with 7 additions and 0 deletions

View File

@@ -56,6 +56,7 @@ func build(path string, optionsPath string) error {
if optionsPath != "" { if optionsPath != "" {
optionsPath = filepath.Join(workingDir, optionsPath) optionsPath = filepath.Join(workingDir, optionsPath)
} }
os.Chdir(workingDir)
} }
options, err := readConfigAt(path) options, err := readConfigAt(path)
if err != nil { if err != nil {

View File

@@ -9,6 +9,7 @@ import (
"fmt" "fmt"
"io" "io"
"os" "os"
"path/filepath"
"time" "time"
"unsafe" "unsafe"
@@ -100,6 +101,7 @@ func generateConfig(path *C.char) (res *C.char) {
} }
func generateConfigFromFile(path string, configOpt config.ConfigOptions) (string, error) { func generateConfigFromFile(path string, configOpt config.ConfigOptions) (string, error) {
os.Chdir(filepath.Dir(path))
content, err := os.ReadFile(path) content, err := os.ReadFile(path)
if err != nil { if err != nil {
return "", err return "", err
@@ -146,6 +148,7 @@ func startService(delayStart bool) error {
if err != nil { if err != nil {
return stopAndAlert(EmptyConfiguration, err) return stopAndAlert(EmptyConfiguration, err)
} }
os.Chdir(filepath.Dir(*activeConfigPath))
var patchedOptions *option.Options var patchedOptions *option.Options
patchedOptions, err = config.BuildConfig(*configOptions, options) patchedOptions, err = config.BuildConfig(*configOptions, options)
if err != nil { if err != nil {

View File

@@ -25,6 +25,7 @@ var (
func Setup(basePath string, workingPath string, tempPath string) { func Setup(basePath string, workingPath string, tempPath string) {
libbox.Setup(basePath, workingPath, tempPath, false) libbox.Setup(basePath, workingPath, tempPath, false)
sWorkingPath = workingPath sWorkingPath = workingPath
os.Chdir(sWorkingPath)
sTempPath = tempPath sTempPath = tempPath
sUserID = os.Getuid() sUserID = os.Getuid()
sGroupID = os.Getgid() sGroupID = os.Getgid()

View File

@@ -3,6 +3,7 @@ package mobile
import ( import (
"encoding/json" "encoding/json"
"os" "os"
"path/filepath"
"github.com/hiddify/libcore/config" "github.com/hiddify/libcore/config"
_ "github.com/sagernet/gomobile" _ "github.com/sagernet/gomobile"
@@ -18,6 +19,7 @@ func Parse(path string, tempPath string, debug bool) error {
} }
func BuildConfig(path string, configOptionsJson string) (string, error) { func BuildConfig(path string, configOptionsJson string) (string, error) {
os.Chdir(filepath.Dir(path))
fileContent, err := os.ReadFile(path) fileContent, err := os.ReadFile(path)
if err != nil { if err != nil {
return "", err return "", err