OSDN Git Service

refactor
authorfreewind <nowindlee@gmail.com>
Sun, 6 May 2018 08:02:25 +0000 (16:02 +0800)
committerfreewind <nowindlee@gmail.com>
Sun, 6 May 2018 08:02:25 +0000 (16:02 +0800)
config/config.go

index 731c096..d653b85 100644 (file)
@@ -196,18 +196,17 @@ func rootify(path, root string) string {
 func DefaultDataDir() string {
        // Try to place the data folder in the user's home dir
        home := homeDir()
-       dataDir := "./.bytom"
-       if home != "" {
-               switch runtime.GOOS {
-               case "darwin":
-                       dataDir = filepath.Join(home, "Library", "Bytom")
-               case "windows":
-                       dataDir = filepath.Join(home, "AppData", "Roaming", "Bytom")
-               default:
-                       dataDir = filepath.Join(home, ".bytom")
-               }
+       if home == "" {
+               return "./.bytom"
+       }
+       switch runtime.GOOS {
+       case "darwin":
+               return filepath.Join(home, "Library", "Bytom")
+       case "windows":
+               return filepath.Join(home, "AppData", "Roaming", "Bytom")
+       default:
+               return filepath.Join(home, ".bytom")
        }
-       return dataDir
 }
 
 func homeDir() string {