1
0
forked from x/icebergs
This commit is contained in:
IT 老营长 @云轩领航-创始人 2023-10-13 10:41:58 +08:00
parent 2f6795a70e
commit d517ee6ebe
2 changed files with 8 additions and 14 deletions

View File

@ -208,21 +208,14 @@ func init() {
})
}
var bind = []string{
"usr/icebergs/core/chat/", "usr/volcanos/panel/",
"usr/icebergs/core/", "usr/volcanos/plugin/local/",
}
func Relative(m *ice.Message, p string) string {
p = kit.TrimPrefix(p, kit.Path("")+PS)
for i := 0; i < len(bind); i += 2 {
if strings.HasPrefix(p, bind[i]) {
if _p := kit.ExtChange(strings.Replace(p, bind[i], bind[i+1], 1), JS); Exists(m, _p) {
return _p
}
}
if _p := kit.ExtChange(p, JS); Exists(m, _p) {
return _p
} else if _p := kit.ExtChange(path.Join(ice.USR_VOLCANOS, "plugin/local", path.Join(kit.Slice(kit.Split(p, "/"), -2)...)), JS); Exists(m, _p) {
return _p
} else {
return p
}
return kit.ExtChange(p, JS)
}
func SplitPath(m *ice.Message, p string) []string {
if kit.HasPrefix(p, ice.REQUIRE_SRC, ice.REQUIRE_USR) {

View File

@ -405,7 +405,8 @@ func init() {
if p = path.Join(cache, path.Join(arg...)); !nfs.Exists(m, p) {
if p = path.Join(ice.USR_REQUIRE, path.Join(arg...)); !nfs.Exists(m, p) {
if m.Warn(kit.Lasterr(git.PlainClone(path.Join(ice.USR_REQUIRE, path.Join(arg[:3]...)), false, &git.CloneOptions{
URL: ice.HTTPS + "://" + ls[0], Depth: 1, ReferenceName: plumbing.NewTagReferenceName(kit.Select(ice.Info.Gomod[ls[0]], ls, 1)),
URL: ice.HTTPS + "://" + path.Join(arg[0], arg[1], ls[0]), Depth: 1,
ReferenceName: plumbing.NewTagReferenceName(kit.Select(ice.Info.Gomod[ls[0]], ls, 1)),
}))) {
return
}