From e2c667101c44747fd54704b68b8bde0fc29b1c0b Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 3 Aug 2013 13:34:48 -0700 Subject: [PATCH] common: style --- common/config.go | 4 ++-- common/download.go | 11 +++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/common/config.go b/common/config.go index 3ea041a6f..ff173423f 100644 --- a/common/config.go +++ b/common/config.go @@ -74,8 +74,8 @@ func DownloadableURL(original string) (string, error) { } if url.Scheme == "file" { - // For Windows absolute file paths, remove leading / - // prior to processing + // For Windows absolute file paths, remove leading / prior to processing + // since net/url turns "C:/" into "/C:/" if runtime.GOOS == "windows" && url.Path[0] == '/' { url.Path = url.Path[1:len(url.Path)] } diff --git a/common/download.go b/common/download.go index 0997b0f1d..6edf43620 100644 --- a/common/download.go +++ b/common/download.go @@ -107,12 +107,11 @@ func (d *DownloadClient) Get() (string, error) { // Files when we don't copy the file are special cased. var finalPath string if url.Scheme == "file" && !d.config.CopyFile { - // Remove forward slash on absolute Windows file URLs - // Before processing - if runtime.GOOS == "windows" && url.Path[0] == '/' { - finalPath = url.Path[1:len(url.Path)] - } else { - finalPath = url.Path + finalPath = url.Path + + // Remove forward slash on absolute Windows file URLs before processing + if runtime.GOOS == "windows" && finalPath[0] == '/' { + finalPath = finalPath[1:len(finalPath)] } } else { finalPath = d.config.TargetPath