#!/usr/bin/env python import os, shutil def main(): mobile = "/var/mobile" backupfile = mobile + "/monkeyball_backup" if os.access(backupfile, os.F_OK) != True: print backupfile + " doesn't exist!\nHave you run backup_monkeyball?" exit(1) monkeydir = get_appdir("Monkey Ball.app") if monkeydir == False: print "I can't find Monkey Ball. Is it installed?" exit(1) else: statebin = monkeydir + "/Documents/state.bin" shutil.copyfile(backupfile, statebin) def get_appdir(app): mobile = "/var/mobile" appdir = None apps = os.listdir(mobile + "/Applications") for i in apps: list = os.listdir(mobile + "/Applications/" + i) if (app in list) == True: appdir = mobile + "/Applications/" + i continue if appdir == None: return False else: return appdir if __name__ == "__main__": main()