3 Commits

Author SHA1 Message Date
Filippo Valsorda
b0f7a80e95 Fix getCAROOT switch statement 2018-07-06 20:09:58 -04:00
Lucas Garron
dbad5f86ec Use $XDG_DATA_HOME on macOS if it is set (#40) 2018-07-06 20:02:49 -04:00
Filippo Valsorda
779fa98126 Update README.md 2018-07-04 13:08:32 -04:00
2 changed files with 9 additions and 10 deletions

View File

@@ -54,7 +54,7 @@ $(go env GOPATH)/bin/mkcert
Windows will be supported next. (PRs welcome!)
Warning: the `rootCA-key.pem` file that mkcert automatically generates gives complete power to intercept secure requests from your machine. Do not share it.
> **Warning**: the `rootCA-key.pem` file that mkcert automatically generates gives complete power to intercept secure requests from your machine. Do not share it.
## Advanced topics

17
main.go
View File

@@ -137,24 +137,23 @@ func getCAROOT() string {
}
var dir string
switch runtime.GOOS {
case "windows":
switch {
case runtime.GOOS == "windows":
dir = os.Getenv("LocalAppData")
case "darwin":
case os.Getenv("XDG_DATA_HOME") != "":
dir = os.Getenv("XDG_DATA_HOME")
case runtime.GOOS == "darwin":
dir = os.Getenv("HOME")
if dir == "" {
return ""
}
dir = filepath.Join(dir, "Library", "Application Support")
default: // Unix
dir = os.Getenv("XDG_DATA_HOME")
dir = os.Getenv("HOME")
if dir == "" {
dir = os.Getenv("HOME")
if dir == "" {
return ""
}
dir = filepath.Join(dir, ".local", "share")
return ""
}
dir = filepath.Join(dir, ".local", "share")
}
return filepath.Join(dir, "mkcert")
}