1
0
mirror of https://github.com/minio/mc.git synced 2025-11-16 11:02:34 +03:00

fix dir listing bug and find style output

This commit is contained in:
Anand Babu (AB) Periasamy
2015-04-23 12:50:08 -07:00
parent 256d7c4443
commit 0a50606cbd
3 changed files with 5 additions and 7 deletions

View File

@@ -46,7 +46,7 @@ func printItems(v []*client.Item) {
// printItem prints item meta-data // printItem prints item meta-data
func printItem(date time.Time, v int64, name string) { func printItem(date time.Time, v int64, name string) {
fmt.Printf(console.Time("[%s] ", date.Local().Format(printDate))) fmt.Printf(console.Time("[%s] ", date.Local().Format(printDate)))
fmt.Printf(console.Size("%5s ", humanize.Bytes(uint64(v)))) fmt.Printf(console.Size("%6s ", humanize.IBytes(uint64(v))))
fmt.Println(console.File("%s", name)) fmt.Println(console.File("%s", name))
} }

View File

@@ -68,7 +68,7 @@ func (s *MySuite) TestList(c *C) {
fsc = New(root) fsc = New(root)
items, err := fsc.List() items, err := fsc.List()
c.Assert(err, IsNil) c.Assert(err, IsNil)
c.Assert(len(items), Equals, 2) c.Assert(len(items), Equals, 3)
} }
func (s *MySuite) TestPutBucket(c *C) { func (s *MySuite) TestPutBucket(c *C) {

View File

@@ -119,15 +119,13 @@ func (f *fsClient) List() (items []*client.Item, err error) {
} }
return err // fatal return err // fatal
} }
if fi.IsDir() {
return nil // not a fs skip
}
// trim f.path
item := &client.Item{ item := &client.Item{
Name: strings.TrimPrefix(fp, f.path+string(filepath.Separator)), // Name: strings.TrimPrefix(fp, f.path+string(filepath.Separator)),
Name: fp,
Time: fi.ModTime(), Time: fi.ModTime(),
Size: fi.Size(), Size: fi.Size(),
} }
items = append(items, item) items = append(items, item)
return nil return nil
} }