Skip to content

Commit

Permalink
fix: Make all paths use / :anchor:
Browse files Browse the repository at this point in the history
  • Loading branch information
gabyx committed Jan 25, 2024
1 parent a6bbd8e commit be95bb4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
1 change: 1 addition & 0 deletions githooks/cmd/common/install/install-prompts.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ func PromptExistingRepos(
}

homeDir, err := homedir.Dir()
homeDir = filepath.ToSlash(homeDir)
cm.AssertNoErrorPanic(err, "Could not get home directory.")

searchDir := gitx.GetConfig(hooks.GitCKPreviousSearchDir, git.GlobalScope)
Expand Down
6 changes: 1 addition & 5 deletions githooks/cmd/installer/installer.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
"github.com/gabyx/githooks/githooks/updates"
"github.com/gabyx/githooks/githooks/updates/download"

"github.com/mitchellh/go-homedir"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
"github.com/spf13/viper"
Expand Down Expand Up @@ -703,9 +702,6 @@ func searchTemplateDirOnDisk(log cm.ILogContext, promptx prompt.IContext) string
func setupNewTemplateDir(log cm.ILogContext, installDir string, promptx prompt.IContext) string {
templateDir := path.Join(installDir, "templates")

homeDir, err := homedir.Dir()
cm.AssertNoErrorPanic(err, "Could not get home directory.")

if promptx != nil {
var err error
templateDir, err = promptx.ShowEntry(
Expand All @@ -715,7 +711,7 @@ func setupNewTemplateDir(log cm.ILogContext, installDir string, promptx prompt.I
log.AssertNoErrorF(err, "Could not show prompt.")
}

templateDir = cm.ReplaceTildeWith(templateDir, homeDir)
templateDir, err := cm.ReplaceTilde(templateDir)
log.AssertNoErrorPanicF(err, "Could not replace tilde '~' in '%s'.", templateDir)

return templateDir
Expand Down
2 changes: 1 addition & 1 deletion githooks/hooks/githooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ func GetDefaultInstallDir() (installDir, installDirRaw string) {
home, err := homedir.Dir()
cm.AssertNoErrorPanic(err, "Could not get home directory.")

installDir = path.Join(home, HooksDirName)
installDir = path.Join(filepath.ToSlash(home), HooksDirName)
installDirRaw = path.Join("~", HooksDirName)

return
Expand Down

0 comments on commit be95bb4

Please sign in to comment.