def doFile(self, path): import zipfile, os modpath = data.modPath() print "Installing mod '%s' to %s" % (path, modpath) zip = zipfile.ZipFile(path, 'r') toplevel = os.path.dirname(zip.namelist()[0]) try: os.makedirs(modpath) except Exception: pass zip.extractall(modpath) self.addMod('%s/%s' % (modpath, toplevel))
def initialize(self): def maybeAdd(path): import os #print "Check path %s" % path full = os.path.join(path, '%s.txt' % os.path.basename(path)) if os.path.exists(full): self.addMod(path) self.setColumnCount(3) import os modpath = data.modPath() if not os.path.exists(modpath): os.makedirs(modpath) for path in os.listdir(modpath): full = os.path.join(modpath, path) maybeAdd(full)