diff --git a/base/ctx/command.go b/base/ctx/command.go index e8c14463..400b7313 100644 --- a/base/ctx/command.go +++ b/base/ctx/command.go @@ -2,6 +2,7 @@ package ctx import ( "path" + "runtime" "strings" ice "shylinux.com/x/icebergs" @@ -121,6 +122,9 @@ func CmdList(m *ice.Message) *ice.Message { func IsOrderCmd(key string) bool { return key[0] == '/' || key[0] == '_' } func FileURI(dir string) string { + if runtime.GOOS == "windows" { + dir = strings.ReplaceAll(dir, "\\", "/") + } if dir == "" { return "" } else if strings.Contains(dir, "/pkg/mod/") { @@ -132,7 +136,12 @@ func FileURI(dir string) string { } return path.Join(nfs.PS, ice.REQUIRE, dir) } -func FileCmd(dir string) string { return FileURI(kit.ExtChange(strings.Split(dir, nfs.DF)[0], nfs.GO)) } +func FileCmd(dir string) string { + if strings.Index(dir, ":") == 1 { + return FileURI(kit.ExtChange(strings.Join(kit.Slice(strings.Split(dir, ":"), 0, 2), ":"), nfs.GO)) + } + return FileURI(kit.ExtChange(strings.Split(dir, nfs.DF)[0], nfs.GO)) +} func AddFileCmd(dir, key string) { ice.Info.File[FileCmd(dir)] = key if ls := strings.SplitN(path.Join(kit.Slice(kit.Split(FileCmd(dir), nfs.PS), 1, 4)...), mdb.AT, 2); len(ls) > 1 { @@ -169,6 +178,12 @@ func TravelCmd(m *ice.Message, cb func(key, file, line string)) *ice.Message { if IsOrderCmd(key) { return } + if runtime.GOOS == "windows" { + if ls := kit.Split(cmd.FileLine(), nfs.DF); len(ls) > 2 { + cb(kit.Keys(s.Prefix(), key), strings.TrimPrefix(strings.Join(kit.Slice(ls, 0, -1), nfs.DF), kit.Path("")+nfs.PS), kit.Select("1", ls, -1)) + return + } + } if ls := kit.Split(cmd.FileLine(), nfs.DF); len(ls) > 0 && cmd.Name != "" { cb(kit.Keys(s.Prefix(), key), strings.TrimPrefix(ls[0], kit.Path("")+nfs.PS), kit.Select("1", ls, 1)) } diff --git a/core/code/binpack.go b/core/code/binpack.go index c9175335..dd509a1a 100644 --- a/core/code/binpack.go +++ b/core/code/binpack.go @@ -64,12 +64,14 @@ func _binpack_all(m *ice.Message) { } list, cache := map[string]string{}, GoCache(m) for k := range ice.Info.File { + m.Debug("what %v", k) switch ls := kit.Split(k, nfs.PS); ls[1] { case ice.SRC: case ice.USR: list[path.Join(kit.Slice(ls, 1, -1)...)] = "" default: p := path.Join(cache, path.Join(kit.Slice(ls, 1, -1)...)) + m.Debug("what %v %v", ls, p) list[path.Join(nfs.USR, strings.Split(ls[3], mdb.AT)[0], path.Join(kit.Slice(ls, 4)...))] = p } }