From d572648261c31e1b214fdceea3dcd4a639ace6a9 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Mon, 25 Jan 2016 21:27:58 -0800 Subject: [PATCH] ls: On windows truncate the directory prefixes properly. Fixes #1585 --- ls.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ls.go b/ls.go index 3a7aa0b7..e9b18e22 100644 --- a/ls.go +++ b/ls.go @@ -19,6 +19,7 @@ package main import ( "encoding/json" "fmt" + "path/filepath" "runtime" "strings" "time" @@ -130,11 +131,15 @@ func doList(clnt client.Client, isRecursive, isIncomplete bool) *probe.Error { errorIf(content.Err.Trace(clnt.GetURL().String()), "Unable to list folder.") continue } - contentURL := content.URL.Path + // Convert any os specific delimiters to "/". + contentURL := filepath.ToSlash(content.URL.Path) + prefixPath = filepath.ToSlash(prefixPath) + + // Trim prefix path from the content path. contentURL = strings.TrimPrefix(contentURL, prefixPath) content.URL.Path = contentURL parsedContent := parseContent(content) - // print colorized or jsonized content info. + // Print colorized or jsonized content info. printMsg(parsedContent) } return nil