from pathlib import Path
import contextlib
import os

class local_dir_remote:
    def __init__(self, config):
        self.config = config
        self.path = config["path"]

    def list_dir(self):
        path = Path(self.path)
        glob_pattern = '*'
        return list(path.glob(glob_pattern))

    def delete_local_map(self, pathfile):
        with contextlib.suppress(FileNotFoundError):
            if str(pathfile).endswith('.bsp'):
                os.remove(pathfile)
