Skip to content

Commit

Permalink
Update config.go to use env variable if tran is running on Windows (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
soda3x authored Aug 4, 2022
1 parent 73939f9 commit a7f21d7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,12 @@ func LoadConfig(startDir *pflag.Flag) {
log.Fatal(err)
}

viper.AddConfigPath("$HOME/.tran")

// Windows doesn't use the $HOME env variable,
// check if running on Windows and if so, use $USERPROFILE
if runtime.GOOS == "windows" {
viper.AddConfigPath(`$USERPROFILE\\.tran`)
} else {
viper.AddConfigPath("$HOME/.tran")
}

viper.SetConfigName("tran")
Expand Down

0 comments on commit a7f21d7

Please sign in to comment.