Fix bug on windows where the backslash got removed in func MakePath()
authorCyrill Schumacher <cyrill@schumacher.fm>
Sat, 27 Dec 2014 23:10:58 +0000 (10:10 +1100)
committerspf13 <steve.francia@gmail.com>
Tue, 17 Feb 2015 17:14:39 +0000 (12:14 -0500)
helpers/path.go

index f6c77f9c38063c7e38d2f52ac9b28e29432bd4e0..884d807cb23f862a2fac1857e66b69dce61319ac 100644 (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