From: Cyrill Schumacher Date: Sat, 27 Dec 2014 23:10:58 +0000 (+1100) Subject: Fix bug on windows where the backslash got removed in func MakePath() X-Git-Tag: v0.13~23 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=41a516819846b98e3b3d13d03815d6d325fbc1e5;p=brevno-suite%2Fhugo Fix bug on windows where the backslash got removed in func MakePath() --- diff --git a/helpers/path.go b/helpers/path.go index f6c77f9c..884d807c 100644 --- a/helpers/path.go +++ b/helpers/path.go @@ -446,7 +446,14 @@ func GetTempDir(subPath string, fs afero.Fs) string { dir = dir + FilePathSeparator } if subPath != "" { + // preserve windows backslash :-( + if FilePathSeparator == "\\" { + subPath = strings.Replace(subPath, "\\", "____", -1) + } dir = dir + MakePath(subPath) + if FilePathSeparator == "\\" { + dir = strings.Replace(dir, "____", "\\", -1) + } if exists, _ := Exists(dir, fs); exists { return dir