replace path separators again
This commit is contained in:
parent
d5f8881d7e
commit
c34652bc4a
@ -335,13 +335,14 @@ func (i *InstanceManager) InstallFabric(instance string, fabricVersion string) {
|
||||
}
|
||||
client:
|
||||
for _, lib := range metadata.LauncherMeta.Libraries.Client {
|
||||
tokens := strings.Split(ProcessMavenPath(lib.Name), "/")
|
||||
tokens := strings.Split(ProcessMavenPath(lib.Name), string(os.PathSeparator))
|
||||
pkg := tokens[len(tokens)-2]
|
||||
instanceObject.Libraries = append(instanceObject.Libraries, ProcessMavenPath(lib.Name)+"/"+ProcessMavenFilename(lib.Name))
|
||||
instanceObject.Libraries = append(instanceObject.Libraries, filepath.Join(ProcessMavenPath(lib.Name), ProcessMavenFilename(lib.Name)))
|
||||
for ind, path := range instanceObject.Libraries {
|
||||
tokens := strings.Split(path, "/")
|
||||
path = strings.ReplaceAll(path, "/", string(os.PathSeparator))
|
||||
tokens := strings.Split(path, string(os.PathSeparator))
|
||||
if pkg == tokens[len(tokens)-3] {
|
||||
instanceObject.Libraries[ind] = ProcessMavenPath(lib.Name) + "/" + ProcessMavenFilename(lib.Name)
|
||||
instanceObject.Libraries[ind] = filepath.Join(ProcessMavenPath(lib.Name), ProcessMavenFilename(lib.Name))
|
||||
fmt.Printf("duplicate library %s\n", pkg)
|
||||
continue client
|
||||
}
|
||||
@ -349,14 +350,15 @@ client:
|
||||
}
|
||||
common:
|
||||
for _, lib := range metadata.LauncherMeta.Libraries.Common {
|
||||
tokens := strings.Split(ProcessMavenPath(lib.Name), "/")
|
||||
tokens := strings.Split(ProcessMavenPath(lib.Name), string(os.PathSeparator))
|
||||
pkg := tokens[len(tokens)-2]
|
||||
instanceObject.Libraries = append(instanceObject.Libraries, ProcessMavenPath(lib.Name)+"/"+ProcessMavenFilename(lib.Name))
|
||||
instanceObject.Libraries = append(instanceObject.Libraries, filepath.Join(ProcessMavenPath(lib.Name), ProcessMavenFilename(lib.Name)))
|
||||
for ind, path := range instanceObject.Libraries {
|
||||
tokens := strings.Split(path, "/")
|
||||
fmt.Printf("Inspecing path %s with %d tokens", path, len(tokens))
|
||||
path = strings.ReplaceAll(path, "/", string(os.PathSeparator))
|
||||
tokens := strings.Split(path, string(os.PathSeparator))
|
||||
fmt.Printf("Inspecing path %s with %d tokens\n", path, len(tokens))
|
||||
if pkg == tokens[len(tokens)-3] {
|
||||
instanceObject.Libraries[ind] = ProcessMavenPath(lib.Name) + "/" + ProcessMavenFilename(lib.Name)
|
||||
instanceObject.Libraries[ind] = filepath.Join(ProcessMavenPath(lib.Name), ProcessMavenFilename(lib.Name))
|
||||
fmt.Printf("duplicate library %s\n", pkg)
|
||||
continue common
|
||||
}
|
||||
@ -394,13 +396,14 @@ func (i *InstanceManager) InstallQuilt(instance string, quiltVersion string) {
|
||||
}
|
||||
client:
|
||||
for _, lib := range metadata.LauncherMeta.Libraries.Client {
|
||||
tokens := strings.Split(ProcessMavenPath(lib.Name), "/")
|
||||
tokens := strings.Split(ProcessMavenPath(lib.Name), string(os.PathSeparator))
|
||||
pkg := tokens[len(tokens)-2]
|
||||
instanceObject.Libraries = append(instanceObject.Libraries, ProcessMavenPath(lib.Name)+"/"+ProcessMavenFilename(lib.Name))
|
||||
instanceObject.Libraries = append(instanceObject.Libraries, filepath.Join(ProcessMavenPath(lib.Name), ProcessMavenFilename(lib.Name)))
|
||||
for ind, path := range instanceObject.Libraries {
|
||||
tokens := strings.Split(path, "/")
|
||||
path = strings.ReplaceAll(path, "/", string(os.PathSeparator))
|
||||
tokens := strings.Split(path, string(os.PathSeparator))
|
||||
if pkg == tokens[len(tokens)-3] {
|
||||
instanceObject.Libraries[ind] = ProcessMavenPath(lib.Name) + "/" + ProcessMavenFilename(lib.Name)
|
||||
instanceObject.Libraries[ind] = filepath.Join(ProcessMavenPath(lib.Name), ProcessMavenFilename(lib.Name))
|
||||
fmt.Printf("duplicate library %s\n", pkg)
|
||||
continue client
|
||||
}
|
||||
@ -408,13 +411,14 @@ client:
|
||||
}
|
||||
common:
|
||||
for _, lib := range metadata.LauncherMeta.Libraries.Common {
|
||||
tokens := strings.Split(ProcessMavenPath(lib.Name), "/")
|
||||
tokens := strings.Split(ProcessMavenPath(lib.Name), string(os.PathSeparator))
|
||||
pkg := tokens[len(tokens)-2]
|
||||
instanceObject.Libraries = append(instanceObject.Libraries, ProcessMavenPath(lib.Name)+"/"+ProcessMavenFilename(lib.Name))
|
||||
instanceObject.Libraries = append(instanceObject.Libraries, filepath.Join(ProcessMavenPath(lib.Name), ProcessMavenFilename(lib.Name)))
|
||||
for ind, path := range instanceObject.Libraries {
|
||||
tokens := strings.Split(path, "/")
|
||||
path = strings.ReplaceAll(path, "/", string(os.PathSeparator))
|
||||
tokens := strings.Split(path, string(os.PathSeparator))
|
||||
if pkg == tokens[len(tokens)-3] {
|
||||
instanceObject.Libraries[ind] = ProcessMavenPath(lib.Name) + "/" + ProcessMavenFilename(lib.Name)
|
||||
instanceObject.Libraries[ind] = filepath.Join(ProcessMavenPath(lib.Name), ProcessMavenFilename(lib.Name))
|
||||
fmt.Printf("duplicate library %s\n", pkg)
|
||||
continue common
|
||||
}
|
||||
@ -456,13 +460,13 @@ func (i *InstanceManager) InstallForge(instance string, forgeVersion string) {
|
||||
instanceObject.ForgeVersion = forgeVersion
|
||||
outer:
|
||||
for _, lib := range installData.Libraries {
|
||||
tokens := strings.Split(lib.Downloads.Artifact.Path, "/")
|
||||
tokens := strings.Split(lib.Downloads.Artifact.Path, string(os.PathSeparator))
|
||||
pkg := tokens[len(tokens)-2]
|
||||
instanceObject.Libraries = append(instanceObject.Libraries, lib.Downloads.Artifact.Path)
|
||||
for ind, path := range instanceObject.Libraries {
|
||||
tokens := strings.Split(path, "/")
|
||||
tokens := strings.Split(path, string(os.PathSeparator))
|
||||
if pkg == tokens[len(tokens)-3] {
|
||||
instanceObject.Libraries[ind] = ProcessMavenPath(lib.Name) + "/" + ProcessMavenFilename(lib.Name)
|
||||
instanceObject.Libraries[ind] = filepath.Join(ProcessMavenPath(lib.Name), ProcessMavenFilename(lib.Name))
|
||||
fmt.Printf("duplicate library %s\n", pkg)
|
||||
continue outer
|
||||
}
|
||||
|
@ -133,7 +133,6 @@ func ProcessMavenPath(maven string) string {
|
||||
pack := tokens[1]
|
||||
version := tokens[2]
|
||||
path = filepath.Join(path, pack, version)
|
||||
path = strings.ReplaceAll(path, "\\", "/")
|
||||
return path
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user