Skip to content

Commit

Permalink
path fixes, should now work on Mac
Browse files Browse the repository at this point in the history
  • Loading branch information
Cubitect committed Oct 3, 2016
1 parent bd55219 commit fbc6c87
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions asmutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@ def __init__(self,jarpath):
self.classdir = join(self.curdir, 'cache', self.vernam, 'classes')
self.temdir = join(self.curdir, 'Templates')

self.python2 = sys.executable
print 'Python executable is: ' + self.python2

self.disasmpy = self.python2+' '+join(self.curdir,'Krakatau-master','disassemble.py')
self.asmpy = self.python2+' '+join(self.curdir,'Krakatau-master','assemble.py')

self.maps = dict()

def setup(self):
Expand Down Expand Up @@ -72,6 +66,14 @@ def expand(self,key):
except:
return None

def disasmpy(self,className):
cmd = sys.executable+' "'+join(self.curdir,'Krakatau-master','disassemble.py')+'"'
os.system(cmd+' -out "'+self.asmdir+'" "'+join(self.classdir,className)+'.class" > '+os.devnull)

def asmpyall(self):
cmd = sys.executable+' "'+join(self.curdir,'Krakatau-master','assemble.py')+'"'
os.system(cmd+' -out "'+self.modcdir+'" -r -q "'+self.modjdir+'"')

def map2j(self,className):
className = self.getmap(className)
outf = join(self.modjdir,className)+'.j'
Expand All @@ -81,7 +83,7 @@ def map2j(self,className):
if isfile(outf):
return outf
print 'Disassembling ' + className + '...'
os.system(self.disasmpy+' -out '+self.asmdir+' '+join(self.classdir,className)+'.class > '+os.devnull)
self.disasmpy(className)
return outf

def getjfile(self,className):
Expand All @@ -92,7 +94,7 @@ def getjfile(self,className):
if isfile(outf):
return outf
print 'Disassembling ' + className + '...'
os.system(self.disasmpy+' -out '+self.asmdir+' '+join(self.classdir,className)+'.class > '+os.devnull)
self.disasmpy(className)
return outf

def readj(self,className):
Expand All @@ -115,8 +117,7 @@ def write2mod(self,className,lines):
def install(self,instver):
# create the mod
print 'Reassembling the modded classes...'
os.system(self.asmpy+' -out '+self.modcdir+' -r -q '+self.modjdir)

self.asmpyall()
# install the mod
copytree(self.modcdir,self.classdir)
instdir = self.jardir.replace(self.vernam,instver)
Expand All @@ -125,6 +126,8 @@ def install(self,instver):
if not isdir(instdir):
os.makedirs(instdir)
instzip = shutil.make_archive(instjar,format="zip",root_dir=self.classdir)
if isfile(instjar):
os.remove(instjar)
os.rename(instzip,instjar)

oldjson = join(self.jardir,self.vernam+'.json')
Expand Down
Binary file modified asmutils.pyc
Binary file not shown.

0 comments on commit fbc6c87

Please sign in to comment.