Ejemplo n.º 1
0
    def __init__(self):

        new_updater_dir = wdir_prefix + "update_scratchdir/updater-lib"
        if os.path.exists(new_updater_dir):
            # We found a new version of the updater, from when the updater presumably just ran
            old_updater_dir = wdir_prefix + "updater-lib"
            if os.path.exists(old_updater_dir):
                shutil.rmtree(old_updater_dir)
            shutil.copytree(new_updater_dir, old_updater_dir)
            shutil.rmtree(wdir_prefix + "update_scratchdir")

        # Load items/trinkets info
        with open(wdir_prefix + "items.json", "r") as items_file:
            Item.items_info = json.load(items_file)
        ItemInfo.check_item_keys(Item.items_info, "items.json")

        with open(wdir_prefix + "items_custom.json", "r") as custom_items_file:
            Item.custom_items_info = json.load(custom_items_file)
        Item.determine_custom_item_names()
        ItemInfo.check_item_keys(Item.custom_items_info, "items_custom.json")

        # Load version
        with open(wdir_prefix + 'version.txt', 'r') as f:
            self.tracker_version = f.read()

        # Load options
        Options().load_options(wdir_prefix + "options.json")
        defaults_path = "options_default.json"
        # If we're running in production, this file will be in our dir.
        # If we're running from source, it will be up a level
        if not os.path.exists(defaults_path):
            defaults_path = wdir_prefix + defaults_path
        Options().load_missing_defaults(defaults_path)
Ejemplo n.º 2
0
    def __init__(self):

        new_updater_dir = wdir_prefix + "update_scratchdir/updater-lib"
        if os.path.exists(new_updater_dir):
            # We found a new version of the updater, from when the updater presumably just ran
            old_updater_dir = wdir_prefix + "updater-lib"
            if os.path.exists(old_updater_dir):
                shutil.rmtree(old_updater_dir)
            shutil.copytree(new_updater_dir, old_updater_dir)
            shutil.rmtree(wdir_prefix + "update_scratchdir")

        # Load items/trinkets info
        with open(wdir_prefix + "items.json", "r") as items_file:
            Item.items_info = json.load(items_file)
        ItemInfo.check_item_keys(Item.items_info, "items.json")
        
        with open(wdir_prefix + "items_custom.json", "r") as custom_items_file:
            Item.custom_items_info = json.load(custom_items_file)
        Item.determine_custom_item_names()
        ItemInfo.check_item_keys(Item.custom_items_info, "items_custom.json")


    # Load version
        with open(wdir_prefix + 'version.txt', 'r') as f:
            self.tracker_version = f.read()

        # Load options
        Options().load_options(wdir_prefix + "options.json")
        defaults_path = "options_default.json"
        # If we're running in production, this file will be in our dir.
        # If we're running from source, it will be up a level
        if not os.path.exists(defaults_path):
            defaults_path = wdir_prefix + defaults_path
        Options().load_missing_defaults(defaults_path)