From bf4d4ac583759c9a5750a92d3935e7f3299c023d Mon Sep 17 00:00:00 2001 From: Samuel Walker Date: Thu, 31 Oct 2024 17:47:50 -0600 Subject: [PATCH] fixed fabric --- fclauncher/InstanceManager.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/fclauncher/InstanceManager.go b/fclauncher/InstanceManager.go index 72add3f..4c30338 100644 --- a/fclauncher/InstanceManager.go +++ b/fclauncher/InstanceManager.go @@ -306,11 +306,33 @@ func (i *InstanceManager)InstallFabric(instance string, fabricVersion string) { if err != nil { fmt.Printf("unable to get version metadata\n") } + client: for _, lib := range metadata.LauncherMeta.Libraries.Client { + tokens := strings.Split(ProcessMavenPath(lib.Name), string(os.PathSeparator)) + pkg := tokens[len(tokens)-2] instanceObject.Libraries = append(instanceObject.Libraries, filepath.Join(ProcessMavenPath(lib.Name), ProcessMavenFilename(lib.Name))) + for ind, path := range instanceObject.Libraries { + tokens := strings.Split(path, string(os.PathSeparator)) + if pkg == tokens[len(tokens)-3] { + instanceObject.Libraries[ind] = filepath.Join(ProcessMavenPath(lib.Name), ProcessMavenFilename(lib.Name)) + fmt.Printf("duplicate library %s\n", pkg) + continue client + } + } } + common: for _, lib := range metadata.LauncherMeta.Libraries.Common { + tokens := strings.Split(ProcessMavenPath(lib.Name), string(os.PathSeparator)) + pkg := tokens[len(tokens)-2] instanceObject.Libraries = append(instanceObject.Libraries, filepath.Join(ProcessMavenPath(lib.Name), ProcessMavenFilename(lib.Name))) + for ind, path := range instanceObject.Libraries { + tokens := strings.Split(path, string(os.PathSeparator)) + if pkg == tokens[len(tokens)-3] { + instanceObject.Libraries[ind] = filepath.Join(ProcessMavenPath(lib.Name), ProcessMavenFilename(lib.Name)) + fmt.Printf("duplicate library %s\n", pkg) + continue common + } + } } instanceObject.Libraries = append(instanceObject.Libraries, filepath.Join(ProcessMavenPath(metadata.Loader.Maven), ProcessMavenFilename(metadata.Loader.Maven)))