Make FakeDownloader create dirs as Downloader does.

pull/35/head
Andrey Smirnov 2013-12-26 23:22:15 +04:00
parent 08c9b12595
commit 8b9bf800ce
1 changed files with 7 additions and 0 deletions
utils

View File

@ -3,6 +3,7 @@ package utils
import (
"fmt"
"os"
"path/filepath"
)
type expectedRequest struct {
@ -61,6 +62,12 @@ func (f *FakeDownloader) Download(url string, filename string, result chan<- err
return
}
err := os.MkdirAll(filepath.Dir(filename), 0755)
if err != nil {
result <- err
return
}
outfile, err := os.Create(filename)
if err != nil {
result <- err