mirror of
https://github.com/minio/minio.git
synced 2025-11-07 04:42:56 -05:00
removed HomeDir
This commit is contained in:
@@ -20,10 +20,9 @@ import (
|
||||
"encoding/json"
|
||||
"io"
|
||||
"os"
|
||||
"os/user"
|
||||
"path"
|
||||
"sync"
|
||||
|
||||
"github.com/minio-io/minio/pkg/utils/helpers"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
@@ -41,7 +40,12 @@ type User struct {
|
||||
|
||||
// Initialize config directory and template config
|
||||
func (c *Config) SetupConfig() error {
|
||||
confPath := path.Join(helpers.HomeDir(), ".minio")
|
||||
u, err := user.Current()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
confPath := path.Join(u.HomeDir, ".minio")
|
||||
if err := os.MkdirAll(confPath, os.ModeDir); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -19,23 +19,9 @@ package helpers
|
||||
import (
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"runtime"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Get current user home directory
|
||||
func HomeDir() string {
|
||||
if runtime.GOOS == "windows" {
|
||||
home := os.Getenv("HOMEDRIVE") + os.Getenv("HOMEPATH")
|
||||
if home == "" {
|
||||
home = os.Getenv("USERPROFILE")
|
||||
}
|
||||
return home
|
||||
}
|
||||
return os.Getenv("HOME")
|
||||
}
|
||||
|
||||
// Create a new temp directory
|
||||
func MakeTempTestDir() (string, error) {
|
||||
return ioutil.TempDir("/tmp", "minio-test-")
|
||||
|
||||
Reference in New Issue
Block a user