1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-12-04 10:34:55 +02:00

Use filepath.Join instead of manual concat

This commit is contained in:
Luka Markušić 2022-07-31 08:43:31 +02:00
parent 966733240c
commit 767ef31661

View File

@ -18,7 +18,7 @@ import (
func (gui *Gui) getCurrentBranch(path string) string {
readHeadFile := func(path string) (string, error) {
headFile, err := ioutil.ReadFile(fmt.Sprintf("%s%cHEAD", path, os.PathSeparator))
headFile, err := ioutil.ReadFile(filepath.Join(path, "HEAD"))
if err == nil {
content := strings.TrimSpace(string(headFile))
branch := strings.TrimPrefix(content, "ref: refs/heads/")
@ -27,7 +27,7 @@ func (gui *Gui) getCurrentBranch(path string) string {
return "", err
}
gitDirPath := fmt.Sprintf("%s%c.git", path, os.PathSeparator)
gitDirPath := filepath.Join(path, ".git")
if gitDir, err := os.Stat(gitDirPath); err == nil {
if gitDir.IsDir() {