Skip to content

Instantly share code, notes, and snippets.

@PLG
Last active July 5, 2019 20:08
Show Gist options
  • Save PLG/6196bc01810c2ade88f0843253b56097 to your computer and use it in GitHub Desktop.
Save PLG/6196bc01810c2ade88f0843253b56097 to your computer and use it in GitHub Desktop.
FIX: proper handling of 1.12.json file in mcp940, keyword error "osx"
From ec77eb5c65298387f502e1802ef31d59707b5876 Mon Sep 17 00:00:00 2001
From: PLG <[email protected]>
Date: Thu, 21 Sep 2017 14:02:24 +0200
Subject: [PATCH] FIX: proper handling of natives and path in version.json
file.
---
runtime/MinecraftDiscovery.py | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/runtime/MinecraftDiscovery.py b/runtime/MinecraftDiscovery.py
index 8253b41..7ac03de 100755
--- a/runtime/MinecraftDiscovery.py
+++ b/runtime/MinecraftDiscovery.py
@@ -154,25 +154,31 @@ def getLibraries(root, jsonfile, osKeyword):
if not passRules:
continue
- if 'natives' in library:
- libFilename = "%s-%s-%s.jar"%(libSubdir, libVersion, substitueString(library['natives'][osKeyword]))
- else:
- libFilename = "%s-%s.jar"%(libSubdir, libVersion)
-
if 'extract' in library:
extract = True
if 'exclude' in library['extract']:
exclude.extend(library['extract']['exclude'])
#libFullPath = os.path.join(os.path.join(root, "libraries"), libPath, libSubdir, libVersion, libFilename)
- libRelativePath = os.path.join("libraries", libPath, libSubdir, libVersion, libFilename)
-
+ if 'natives' in library:
+ try:
+ libRelativePath= os.path.join("libraries",library['downloads']['classifiers'][library['natives'][osKeyword]]['path'])
+ except Exception as e:
+ libRelativePath= os.path.join("libraries",library['downloads']['artifact']['path'])
+ else:
+ libRelativePath= os.path.join("libraries",library['downloads']['artifact']['path'])
+
+ #libRelativePath = os.path.join("libraries", libPath, libSubdir, libVersion, libFilename)
+ #print "libRelativePath -- %s"%libRelativePath
+
#if not os.path.exists(libFullPath):
# print ("Error while trying to access libraries. Couldn't find %s"%libFullPath)
# sys.exit()
- if 'natives' in library:
- outLibraries['%s-%s' % (libSubdir, substitueString(library['natives'][osKeyword]))] = {'name':library['name'], 'filename':libRelativePath, 'extract':extract, 'exclude':exclude}
- else:
+ #if 'natives' in library:
+ try:
+ outLibraries['%s-%s' % (libSubdir, substitueString(library['natives'][osKeyword]))] \
+ = {'name':library['name'], 'filename':libRelativePath, 'extract':extract, 'exclude':exclude}
+ except Exception as e:
outLibraries[libSubdir] = {'name':library['name'], 'filename':libRelativePath, 'extract':extract, 'exclude':exclude}
return outLibraries
--
2.10.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment