Fix bug on windows where the backslash got removed in func MakePath()

This commit is contained in:
Cyrill Schumacher 2014-12-28 10:10:58 +11:00 committed by spf13
parent 5e2d3d2e10
commit 41a5168198

View file

@ -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