Skip to content

Commit

Permalink
Remove unnecessary typecasts
Browse files Browse the repository at this point in the history
  • Loading branch information
twpayne committed Apr 30, 2021
1 parent a273809 commit 361ce17
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions cmd/config.go
Expand Up @@ -505,7 +505,7 @@ func (c *Config) defaultConfigFile(fs vfs.Stater, bds *xdg.BaseDirectorySpecific
return "", err
}
for _, extension := range viper.SupportedExts {
configFileAbsPath := configDirAbsPath.Join(chezmoi.RelPath("chezmoi"), chezmoi.RelPath("chezmoi."+extension))
configFileAbsPath := configDirAbsPath.Join("chezmoi", chezmoi.RelPath("chezmoi."+extension))
if _, err := fs.Stat(string(configFileAbsPath)); err == nil {
return configFileAbsPath, nil
}
Expand All @@ -516,7 +516,7 @@ func (c *Config) defaultConfigFile(fs vfs.Stater, bds *xdg.BaseDirectorySpecific
if err != nil {
return "", err
}
return configHomeAbsPath.Join(chezmoi.RelPath("chezmoi"), chezmoi.RelPath("chezmoi.toml")), nil
return configHomeAbsPath.Join("chezmoi", "chezmoi.toml"), nil
}

func (c *Config) defaultPreApplyFunc(targetRelPath chezmoi.RelPath, targetEntryState, lastWrittenEntryState, actualEntryState *chezmoi.EntryState) error {
Expand Down Expand Up @@ -571,7 +571,7 @@ func (c *Config) defaultSourceDir(fs vfs.Stater, bds *xdg.BaseDirectorySpecifica
if err != nil {
return "", err
}
sourceDirAbsPath := dataDirAbsPath.Join(chezmoi.RelPath("chezmoi"))
sourceDirAbsPath := dataDirAbsPath.Join("chezmoi")
if _, err := fs.Stat(string(sourceDirAbsPath)); err == nil {
return sourceDirAbsPath, nil
}
Expand All @@ -581,7 +581,7 @@ func (c *Config) defaultSourceDir(fs vfs.Stater, bds *xdg.BaseDirectorySpecifica
if err != nil {
return "", err
}
return dataHomeAbsPath.Join(chezmoi.RelPath("chezmoi")), nil
return dataHomeAbsPath.Join("chezmoi"), nil
}

func (c *Config) defaultTemplateData() map[string]interface{} {
Expand Down Expand Up @@ -1264,7 +1264,7 @@ func (c *Config) persistentStateFile() (chezmoi.AbsPath, error) {
if err != nil {
return "", err
}
persistentStateFile := configDirAbsPath.Join(chezmoi.RelPath("chezmoi"), persistentStateFilename)
persistentStateFile := configDirAbsPath.Join("chezmoi", persistentStateFilename)
if _, err := os.Stat(string(persistentStateFile)); err == nil {
return persistentStateFile, nil
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/initcmd.go
Expand Up @@ -105,7 +105,7 @@ func (c *Config) runInitCmd(cmd *cobra.Command, args []string) error {
}

// If the source repo does not exist then init or clone it.
switch _, err := c.baseSystem.Stat(c.SourceDirAbsPath.Join(chezmoi.RelPath(".git"))); {
switch _, err := c.baseSystem.Stat(c.SourceDirAbsPath.Join(".git")); {
case os.IsNotExist(err):
rawSourceDir, err := c.baseSystem.RawPath(c.SourceDirAbsPath)
if err != nil {
Expand Down

0 comments on commit 361ce17

Please sign in to comment.