Skip to content

Commit

Permalink
fix(): user: Current not implemented when cross compiled
Browse files Browse the repository at this point in the history
Close #14
  • Loading branch information
aubm committed Apr 5, 2016
1 parent 07c5287 commit be820bf
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,20 @@ func main() {

themesDirectory = os.Getenv("POSTMANERATOR_PATH")
if themesDirectory == "" {
var usrHomeDir string
usr, err := user.Current()
checkAndPrintErr(err, fmt.Sprintf("An error occured while trying to determine which directory to use for themes: %v", err))
themesDirectory = fmt.Sprintf("%v/.postmanerator", usr.HomeDir)
if err != nil {
if usrHomeDir = os.Getenv("HOME"); usrHomeDir == "" {
if usrHomeDir = os.Getenv("USERPROFILE"); usrHomeDir == "" {
checkAndPrintErr(err, `An error occured while trying to determine which directory to use for themes.
As a workaround, you can define the POSTMANERATOR_PATH environement variable.
Please consult the documentation here https://github.com/aubm/postmanerator and feel free to submit an issue.`)
}
}
} else {
usrHomeDir = usr.HomeDir
}
themesDirectory = fmt.Sprintf("%v/.postmanerator", usrHomeDir)
}
themesDirectory += "/themes"
if _, err := os.Stat(themesDirectory); os.IsNotExist(err) {
Expand Down

0 comments on commit be820bf

Please sign in to comment.