Skip to content

Commit

Permalink
Use login user name when available
Browse files Browse the repository at this point in the history
  • Loading branch information
Wilken Rivera authored and nywilken committed Mar 7, 2023
1 parent 62bcc50 commit ac3abdc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pathing/config_file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package pathing

import (
"fmt"
"os"
"os/user"
"path/filepath"
"runtime"
Expand All @@ -17,6 +18,9 @@ func platform_user() string {
// on the windows platform, whereas the correct way is to use
// the api or to scrape `net user`.
if runtime.GOOS == "windows" {
if loginUser := os.Getenv("USERNAME"); loginUser != "" {
return loginUser
}
return "Administrator"
}
return "root"
Expand Down

0 comments on commit ac3abdc

Please sign in to comment.