mirror of
https://github.com/pgsty/minio.git
synced 2026-08-09 15:53:28 +03:00
Make get/put more robust
- init folder if not present already in 'get()' call
- put.go was referencing wrong args - fix it
- if no OBJECTNAME is specified during 'get' - grab a
list of files under "~/.minio"
- Provide new API GetList() for ObjectStorage struct
This commit is contained in:
@@ -176,5 +176,23 @@ func getMinioDir() string {
|
||||
log.Fatal(err)
|
||||
}
|
||||
homePath := user.HomeDir
|
||||
return path.Join(homePath, ".minio")
|
||||
minioPath := path.Join(homePath, ".minio")
|
||||
err = _initMinioDir(minioPath)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
return minioPath
|
||||
}
|
||||
|
||||
func _initMinioDir(dirPath string) error {
|
||||
_, err := os.Lstat(dirPath)
|
||||
if err != nil {
|
||||
log.Printf("%s not found, creating a new-one for the first time",
|
||||
dirPath)
|
||||
err = os.Mkdir(dirPath, 0700)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user