cue: fix Windows breakage
Closes #75
https://github.com/cuelang/cue/pull/75
GitOrigin-RevId: ea4d1dab20c71fc1bf66f9a6077d0e19dcd0b030
Change-Id: I70736f7d67a8b37500d618573999e2fb1caad7ea
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/2960
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
diff --git a/cue/marshal.go b/cue/marshal.go
index 5a69ea5..885bbb1 100644
--- a/cue/marshal.go
+++ b/cue/marshal.go
@@ -165,13 +165,17 @@
dir = i.inst.Root
}
if dir != "" {
+ filename = filepath.FromSlash(filename)
filename, _ = filepath.Rel(dir, filename)
filename = filepath.ToSlash(filename)
}
}
+ // TODO: this should probably be changed upstream, but as the path
+ // is for reference purposes only, this is safe.
+ importPath := filepath.ToSlash(i.ImportPath)
staged = append(staged, instanceData{
- Path: i.ImportPath,
+ Path: importPath,
Files: []fileData{{filename, b}},
})