internal/filetypes: fix Windows breakage

Closes #298
https://github.com/cuelang/cue/pull/298

GitOrigin-RevId: d271f564e64635749a9877b9111b921e70dddf5e
Change-Id: I87ac0191d4400297648a9db8194ce0fc115df132
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/5100
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
diff --git a/internal/filetypes/filetypes.go b/internal/filetypes/filetypes.go
index da9194d..8345944 100644
--- a/internal/filetypes/filetypes.go
+++ b/internal/filetypes/filetypes.go
@@ -129,7 +129,7 @@
 	for i, s := range args {
 		a := strings.Split(s, ":")
 		switch {
-		case len(a) == 1: // filename
+		case len(a) == 1 || len(a[0]) == 1: // filename
 			f, err := toFile(v, s)
 			if err != nil {
 				return nil, err
diff --git a/internal/filetypes/filetypes_test.go b/internal/filetypes/filetypes_test.go
index 414da62..d666ec6 100644
--- a/internal/filetypes/filetypes_test.go
+++ b/internal/filetypes/filetypes_test.go
@@ -295,6 +295,12 @@
 			},
 		},
 	}, {
+		in: `json: c:\foo.json c:\path\to\file.dat`,
+		out: []*build.File{
+			{Filename: `c:\foo.json`, Encoding: "json"},
+			{Filename: `c:\path\to\file.dat`, Encoding: "json"},
+		},
+	}, {
 		in:  "json: json+schema: bar.schema",
 		out: `scoped qualifier "json:" without file`,
 	}, {