Skip to content

Commit 2585d90

Browse files
authored
Merge pull request #953 from afbjorklund/windows-iso9660
Use forward slash for iso9660.Create on windows
2 parents b53e7df + f264c90 commit 2585d90

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

pkg/iso9660util/iso9660util.go

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@ package iso9660util
22

33
import (
44
"io"
5+
"io/ioutil"
56
"os"
67
"path"
8+
"path/filepath"
9+
"runtime"
710

811
"github.com/diskfs/go-diskfs/filesystem"
912
"github.com/diskfs/go-diskfs/filesystem/iso9660"
13+
"github.com/sirupsen/logrus"
1014
)
1115

1216
type Entry struct {
@@ -26,7 +30,17 @@ func Write(isoPath, label string, layout []Entry) error {
2630

2731
defer isoFile.Close()
2832

29-
fs, err := iso9660.Create(isoFile, 0, 0, 0, "")
33+
workdir, err := ioutil.TempDir("", "diskfs_iso")
34+
if err != nil {
35+
return err
36+
}
37+
if runtime.GOOS == "windows" {
38+
// go-embed unfortunately needs unix path
39+
workdir = filepath.ToSlash(workdir)
40+
}
41+
logrus.Debugf("Creating iso file %s", isoFile.Name())
42+
logrus.Debugf("Using %s as workspace", workdir)
43+
fs, err := iso9660.Create(isoFile, 0, 0, 0, workdir)
3044
if err != nil {
3145
return err
3246
}

0 commit comments

Comments
 (0)