fixed path madness

This commit is contained in:
= 2024-11-26 16:16:13 -07:00
parent cf24d351e3
commit 3389119d03

View File

@ -336,7 +336,6 @@ func (i *InstanceManager) InstallFabric(instance string, fabricVersion string) {
client: client:
for _, lib := range metadata.LauncherMeta.Libraries.Client { for _, lib := range metadata.LauncherMeta.Libraries.Client {
tokens := strings.Split(ProcessMavenPath(lib.Name), string(os.PathSeparator)) tokens := strings.Split(ProcessMavenPath(lib.Name), string(os.PathSeparator))
fmt.Printf("processing lib %s as path %s with %d tokens", lib.Name, ProcessMavenPath(lib.Name), len(tokens))
pkg := tokens[len(tokens)-2] pkg := tokens[len(tokens)-2]
instanceObject.Libraries = append(instanceObject.Libraries, filepath.Join(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 { for ind, path := range instanceObject.Libraries {
@ -351,11 +350,10 @@ client:
common: common:
for _, lib := range metadata.LauncherMeta.Libraries.Common { for _, lib := range metadata.LauncherMeta.Libraries.Common {
tokens := strings.Split(ProcessMavenPath(lib.Name), string(os.PathSeparator)) tokens := strings.Split(ProcessMavenPath(lib.Name), string(os.PathSeparator))
fmt.Printf("processing lib %s as path %s with %d tokens", lib.Name, ProcessMavenPath(lib.Name), len(tokens))
pkg := tokens[len(tokens)-2] pkg := tokens[len(tokens)-2]
instanceObject.Libraries = append(instanceObject.Libraries, filepath.Join(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 { for ind, path := range instanceObject.Libraries {
tokens := strings.Split(path, string(os.PathSeparator)) tokens := strings.Split(path, "/")
if pkg == tokens[len(tokens)-3] { if pkg == tokens[len(tokens)-3] {
instanceObject.Libraries[ind] = filepath.Join(ProcessMavenPath(lib.Name), ProcessMavenFilename(lib.Name)) instanceObject.Libraries[ind] = filepath.Join(ProcessMavenPath(lib.Name), ProcessMavenFilename(lib.Name))
fmt.Printf("duplicate library %s\n", pkg) fmt.Printf("duplicate library %s\n", pkg)
@ -413,7 +411,7 @@ common:
pkg := tokens[len(tokens)-2] pkg := tokens[len(tokens)-2]
instanceObject.Libraries = append(instanceObject.Libraries, filepath.Join(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 { for ind, path := range instanceObject.Libraries {
tokens := strings.Split(path, string(os.PathSeparator)) tokens := strings.Split(path, "/")
if pkg == tokens[len(tokens)-3] { if pkg == tokens[len(tokens)-3] {
instanceObject.Libraries[ind] = filepath.Join(ProcessMavenPath(lib.Name), ProcessMavenFilename(lib.Name)) instanceObject.Libraries[ind] = filepath.Join(ProcessMavenPath(lib.Name), ProcessMavenFilename(lib.Name))
fmt.Printf("duplicate library %s\n", pkg) fmt.Printf("duplicate library %s\n", pkg)