Using switch instead of if statement for path

This commit is contained in:
Frederick F. Kautz IV
2015-04-10 23:34:34 -07:00
parent 8879bc6986
commit fa62b85a5a
+5 -6
View File
@@ -55,14 +55,13 @@ func getMcConfigDir() (string, error) {
if err != nil {
return "", iodine.New(err, nil)
}
var p string
// For windows the path is slightly differently
if runtime.GOOS == "windows" {
p = path.Join(u.HomeDir, mcConfigWindowsDir)
} else {
p = path.Join(u.HomeDir, mcConfigDir)
switch runtime.GOOS {
case "windows":
return path.Join(u.HomeDir, mcConfigWindowsDir), nil
default:
return path.Join(u.HomeDir, mcConfigDir), nil
}
return p, nil
}
func getOrCreateMcConfigDir() (string, error) {
p, err := getMcConfigDir()