Skip to content

Commit a7f21d7

Browse files
authored
Update config.go to use env variable if tran is running on Windows (#44)
1 parent 73939f9 commit a7f21d7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

internal/config/config.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,12 @@ func LoadConfig(startDir *pflag.Flag) {
4949
log.Fatal(err)
5050
}
5151

52-
viper.AddConfigPath("$HOME/.tran")
53-
52+
// Windows doesn't use the $HOME env variable,
53+
// check if running on Windows and if so, use $USERPROFILE
5454
if runtime.GOOS == "windows" {
5555
viper.AddConfigPath(`$USERPROFILE\\.tran`)
56+
} else {
57+
viper.AddConfigPath("$HOME/.tran")
5658
}
5759

5860
viper.SetConfigName("tran")

0 commit comments

Comments
 (0)