mirror of
https://github.com/minio/minio.git
synced 2025-11-20 09:56:07 -05:00
Use filepath everywhere instead of path.{} functions for portability - fixes #656
This commit is contained in:
@@ -21,7 +21,7 @@ import (
|
||||
"io"
|
||||
"os"
|
||||
"os/user"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"sync"
|
||||
|
||||
"github.com/minio/minio/pkg/iodine"
|
||||
@@ -49,13 +49,13 @@ func (c *Config) SetupConfig() error {
|
||||
return iodine.New(err, nil)
|
||||
}
|
||||
|
||||
confPath := path.Join(u.HomeDir, ".minio")
|
||||
confPath := filepath.Join(u.HomeDir, ".minio")
|
||||
if err := os.MkdirAll(confPath, 0700); err != nil {
|
||||
return iodine.New(err, nil)
|
||||
}
|
||||
|
||||
c.ConfigPath = confPath
|
||||
c.ConfigFile = path.Join(c.ConfigPath, "config.json")
|
||||
c.ConfigFile = filepath.Join(c.ConfigPath, "config.json")
|
||||
if _, err := os.Stat(c.ConfigFile); os.IsNotExist(err) {
|
||||
_, err = os.Create(c.ConfigFile)
|
||||
if err != nil {
|
||||
|
||||
@@ -19,7 +19,7 @@ package config
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
@@ -38,7 +38,7 @@ func (s *MySuite) TestConfig(c *C) {
|
||||
conf.ConfigLock = new(sync.RWMutex)
|
||||
conf.ConfigPath, _ = ioutil.TempDir("/tmp", "minio-test-")
|
||||
defer os.RemoveAll(conf.ConfigPath)
|
||||
conf.ConfigFile = path.Join(conf.ConfigPath, "config.json")
|
||||
conf.ConfigFile = filepath.Join(conf.ConfigPath, "config.json")
|
||||
if _, err := os.Stat(conf.ConfigFile); os.IsNotExist(err) {
|
||||
_, err = os.Create(conf.ConfigFile)
|
||||
if err != nil {
|
||||
|
||||
@@ -20,7 +20,7 @@ import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"path"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/minio/minio/pkg/api/config"
|
||||
@@ -52,7 +52,7 @@ func HTTPHandler() http.Handler {
|
||||
log.Fatal(iodine.New(err, nil))
|
||||
}
|
||||
|
||||
api.webPath = path.Join(api.conf.GetConfigPath(), defaultWeb)
|
||||
api.webPath = filepath.Join(api.conf.GetConfigPath(), defaultWeb)
|
||||
mux.Handle("/{polygon:.*}", http.FileServer(http.Dir(api.webPath))).Methods("GET")
|
||||
mux.HandleFunc("/access", api.accessHandler).Methods("POST")
|
||||
return mux
|
||||
|
||||
Reference in New Issue
Block a user