Skip to content
This repository was archived by the owner on Nov 20, 2022. It is now read-only.

Commit 8e88505

Browse files
committed
fix: 修复VRChatPath可能会获取失败的BUG #6
1 parent 09faa8a commit 8e88505

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

bind.go

+9-8
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
"os"
1313
"os/exec"
1414
"path/filepath"
15-
"strings"
1615
"syscall"
1716
"time"
1817

@@ -21,15 +20,17 @@ import (
2120

2221
// BindVRChatPath 获取VRChat配置目录
2322
func BindVRChatPath() (_path string, err error) {
24-
appdata := os.Getenv("AppData")
23+
var localLow string
24+
appdata := os.Getenv("LOCALAPPDATA")
2525
if appdata == "" {
26-
err = errors.New("The AppData environment variable must be set for app to run correctly.")
27-
return
28-
}
29-
if strings.Contains(appdata, "\\Roaming") {
30-
appdata = filepath.Dir(appdata)
26+
appdata = os.Getenv("APPDATA")
27+
if appdata == "" {
28+
err = errors.New("The AppData environment variable must be set for app to run correctly.")
29+
return
30+
}
3131
}
32-
_path = filepath.Join(appdata, "LocalLow\\VRChat\\VRChat")
32+
localLow = filepath.Join(appdata, "../LocalLow")
33+
_path = filepath.Join(localLow, "VRChat/VRChat")
3334
_, err = os.Stat(_path)
3435
return
3536
}

0 commit comments

Comments
 (0)