def scan_asset_folder(self, folder):
        pak_path = os.path.join(folder, "packed.pak")

        if os.path.isfile(pak_path):
            db = starbound.open_file(pak_path)
            index = [(x, pak_path) for x in db.get_index()]
            return index
        else:
            # old style, probably a mod
            index = []
            mod_assets = None
            files = os.listdir(folder)

            # TODO: will need more logic to handle .modpack with modinfo inside.
            found_mod_info = False

            for f in files:
                if f.endswith(".modinfo"):
                    modinfo = os.path.join(folder, f)
                    try:
                        modinfo_data = load_asset_file(modinfo)
                        path = "./"
                        if "path" in modinfo_data.keys():
                            path = modinfo_data["path"]
                        mod_assets = os.path.join(folder, path)
                        found_mod_info = True
                    except ValueError:
                        # really old mods
                        folder = os.path.join(folder, "assets")
                        if os.path.isdir(folder):
                            mod_assets = folder

            if mod_assets is None:
                return index
            elif found_mod_info and self.is_packed_file(mod_assets):
                # TODO: make a .pak scanner function that works for vanilla and mods
                pak_path = os.path.normpath(mod_assets)
                db = starbound.open_file(pak_path)
                for x in db.get_index():
                    # removes thumbs.db etc from user pak files
                    if re.match(ignore_assets, x) is None:
                        index.append((x, pak_path))
                return index
            elif not os.path.isdir(mod_assets):
                return index

            # now we can scan!
            for root, dirs, files in os.walk(mod_assets):
                for f in files:
                    if re.match(ignore_assets, f) is None:
                        asset_folder = os.path.normpath(mod_assets)
                        asset_file = os.path.normpath(os.path.join(root.replace(folder, ""), f))
                        index.append((asset_file, asset_folder))
            return index
dataset/ETHPy150Open wizzomafizzo/starcheat/starcheat/assets/core.py/Assets.scan_asset_folder/original