X Tutup
Skip to content

Commit 927e4c7

Browse files
committed
using filepath.Join() instead of path.Join() to fix wrong filepath on Windows:
PS C:\Users\Junjie Yuan> gh auth status github.com ✓ Logged in to github.com as junjieyuan (C:\Users\Junjie Yuan\.config\gh/hosts.yml) ✓ Git operations for github.com configured to use https protocol. ✓ Token: ******************* Signed-off-by: Junjie Yuan <yuan@junjie.pro>
1 parent 5821065 commit 927e4c7

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

cmd/gh/main.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77
"net"
88
"os"
99
"os/exec"
10-
"path"
1110
"path/filepath"
1211
"strings"
1312
"time"
@@ -259,7 +258,7 @@ func checkForUpdate(currentVersion string) (*update.ReleaseInfo, error) {
259258
}
260259

261260
repo := updaterEnabled
262-
stateFilePath := path.Join(config.ConfigDir(), "state.yml")
261+
stateFilePath := filepath.Join(config.ConfigDir(), "state.yml")
263262
return update.CheckForUpdate(client, stateFilePath, repo, currentVersion)
264263
}
265264

internal/config/config_file.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ func ConfigDir() string {
2828
}
2929

3030
func ConfigFile() string {
31-
return path.Join(ConfigDir(), "config.yml")
31+
return filepath.Join(ConfigDir(), "config.yml")
3232
}
3333

3434
func HostsConfigFile() string {
35-
return path.Join(ConfigDir(), "hosts.yml")
35+
return filepath.Join(ConfigDir(), "hosts.yml")
3636
}
3737

3838
func ParseDefaultConfig() (Config, error) {

0 commit comments

Comments
 (0)
X Tutup