Skip to content

Commit

Permalink
Merge pull request #169 from Bitspark/add-mkdirall
Browse files Browse the repository at this point in the history
Use forward slashes
  • Loading branch information
jm9e authored Aug 18, 2018
2 parents 47f598b + be45276 commit 12756f8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pkg/daemon/sharing_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func packOperator(e *api.Environ, zipWriter *zip.Writer, fqop string, read map[s
return err
}

fileWriter, _ := zipWriter.Create(absPath[len(p):])
fileWriter, _ := zipWriter.Create(filepath.ToSlash(absPath[len(p):]))
fileContents, err := ioutil.ReadFile(absPath)
if err != nil {
return err
Expand All @@ -56,7 +56,7 @@ func packOperator(e *api.Environ, zipWriter *zip.Writer, fqop string, read map[s
if err != nil {
continue
}
fileWriter, _ := zipWriter.Create(absBasePath[len(p):] + suffix)
fileWriter, _ := zipWriter.Create(filepath.ToSlash(absBasePath[len(p):] + suffix))
fileWriter.Write(fileContents)
}

Expand Down Expand Up @@ -184,7 +184,9 @@ var SharingService = &Service{map[string]*Endpoint{
fileReader, _ := file.Open()
buf := new(bytes.Buffer)
buf.ReadFrom(fileReader)
ioutil.WriteFile(filepath.Join(baseDir, file.Name), buf.Bytes(), os.ModePerm)
fpath := filepath.Join(baseDir, filepath.FromSlash(file.Name))
os.MkdirAll(filepath.Dir(fpath), os.ModePerm)
ioutil.WriteFile(fpath, buf.Bytes(), os.ModePerm)
fileReader.Close()
}

Expand Down

0 comments on commit 12756f8

Please sign in to comment.