From a13166c6afe8f30ee1f13540b601ba1ecb622696 Mon Sep 17 00:00:00 2001 From: Christoph Polcin Date: Thu, 23 Oct 2014 13:38:16 +0200 Subject: [PATCH] set File.path --- client.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/client.go b/client.go index 079ec39..326e0ca 100644 --- a/client.go +++ b/client.go @@ -69,15 +69,17 @@ func getProps(r *response, status string) *props { } func (c *Client) ReadDir(path string) ([]os.FileInfo, error) { + path = FixSlash(path) files := make([]os.FileInfo, 0) parse := func(resp interface{}) { r := resp.(*response) if p := getProps(r, "200"); p != nil { f := new(File) - f.path = "/TODO/" f.name = p.Name + f.path = path + f.name if p.Type.Local == "collection" { + f.path += "/" f.size = 0 f.modified = time.Unix(0, 0) f.isdir = true @@ -88,11 +90,12 @@ func (c *Client) ReadDir(path string) ([]os.FileInfo, error) { } files = append(files, *f) - r.Props = nil } + + r.Props = nil } - err := c.Propfind(FixSlash(path), false, + err := c.Propfind(path, false, `