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>
This commit is contained in:
Junjie Yuan 2021-04-22 15:10:35 +08:00
parent 5821065ac0
commit 927e4c7e4d
No known key found for this signature in database
GPG key ID: AC081F6D3EEA5EED
2 changed files with 3 additions and 4 deletions

View file

@ -7,7 +7,6 @@ import (
"net"
"os"
"os/exec"
"path"
"path/filepath"
"strings"
"time"
@ -259,7 +258,7 @@ func checkForUpdate(currentVersion string) (*update.ReleaseInfo, error) {
}
repo := updaterEnabled
stateFilePath := path.Join(config.ConfigDir(), "state.yml")
stateFilePath := filepath.Join(config.ConfigDir(), "state.yml")
return update.CheckForUpdate(client, stateFilePath, repo, currentVersion)
}

View file

@ -28,11 +28,11 @@ func ConfigDir() string {
}
func ConfigFile() string {
return path.Join(ConfigDir(), "config.yml")
return filepath.Join(ConfigDir(), "config.yml")
}
func HostsConfigFile() string {
return path.Join(ConfigDir(), "hosts.yml")
return filepath.Join(ConfigDir(), "hosts.yml")
}
func ParseDefaultConfig() (Config, error) {