mirror of
https://github.com/minio/minio.git
synced 2024-12-26 23:25:54 -05:00
removed HomeDir
This commit is contained in:
parent
cd22304afb
commit
177121868b
@ -18,6 +18,7 @@ package server
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
|
"os/user"
|
||||||
"path"
|
"path"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
@ -27,7 +28,6 @@ import (
|
|||||||
mstorage "github.com/minio-io/minio/pkg/storage"
|
mstorage "github.com/minio-io/minio/pkg/storage"
|
||||||
"github.com/minio-io/minio/pkg/storage/fs"
|
"github.com/minio-io/minio/pkg/storage/fs"
|
||||||
"github.com/minio-io/minio/pkg/storage/inmemory"
|
"github.com/minio-io/minio/pkg/storage/inmemory"
|
||||||
"github.com/minio-io/minio/pkg/utils/helpers"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type ServerConfig struct {
|
type ServerConfig struct {
|
||||||
@ -128,8 +128,11 @@ func getStorageChannels(storageType StorageType) (ctrlChans []chan<- string, sta
|
|||||||
}
|
}
|
||||||
case storageType == FileStorage:
|
case storageType == FileStorage:
|
||||||
{
|
{
|
||||||
homeDir := helpers.HomeDir()
|
u, err := user.Current()
|
||||||
root := path.Join(homeDir, "minio-storage")
|
if err != nil {
|
||||||
|
return nil, nil, nil
|
||||||
|
}
|
||||||
|
root := path.Join(u.HomeDir, "minio-storage")
|
||||||
ctrlChan, statusChan, storage = fs.Start(root)
|
ctrlChan, statusChan, storage = fs.Start(root)
|
||||||
ctrlChans = append(ctrlChans, ctrlChan)
|
ctrlChans = append(ctrlChans, ctrlChan)
|
||||||
statusChans = append(statusChans, statusChan)
|
statusChans = append(statusChans, statusChan)
|
||||||
|
@ -20,10 +20,9 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
|
"os/user"
|
||||||
"path"
|
"path"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/minio-io/minio/pkg/utils/helpers"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
@ -41,7 +40,12 @@ type User struct {
|
|||||||
|
|
||||||
// Initialize config directory and template config
|
// Initialize config directory and template config
|
||||||
func (c *Config) SetupConfig() error {
|
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 {
|
if err := os.MkdirAll(confPath, os.ModeDir); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -19,23 +19,9 @@ package helpers
|
|||||||
import (
|
import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
|
||||||
"runtime"
|
|
||||||
"strings"
|
"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
|
// Create a new temp directory
|
||||||
func MakeTempTestDir() (string, error) {
|
func MakeTempTestDir() (string, error) {
|
||||||
return ioutil.TempDir("/tmp", "minio-test-")
|
return ioutil.TempDir("/tmp", "minio-test-")
|
||||||
|
Loading…
Reference in New Issue
Block a user