Use filepath instead of path for file path operations

In practice, using path seems to work too, since Windows seems to be capable of
dealing with a path like C:/x/y instead of C:\x\y; but it's cleaner to do this
properly.
This commit is contained in:
Stefan Haller 2024-07-31 14:41:33 +02:00
parent 07dd8a2b07
commit 75a95865ff
3 changed files with 78 additions and 25 deletions

View file

@ -3,7 +3,7 @@ package git_commands
import (
"fmt"
"os"
"path"
"path/filepath"
"github.com/go-errors/errors"
"github.com/jesseduffield/lazygit/pkg/commands/models"
@ -233,7 +233,7 @@ func (self *WorkingTreeCommands) Ignore(filename string) error {
// Exclude adds a file to the .git/info/exclude for the repo
func (self *WorkingTreeCommands) Exclude(filename string) error {
excludeFile := path.Join(self.repoPaths.repoGitDirPath, "info", "exclude")
excludeFile := filepath.Join(self.repoPaths.repoGitDirPath, "info", "exclude")
return self.os.AppendLineToFile(excludeFile, filename)
}