import sys
import os
from module_utils import find_module_path

def configure_paths():
    """Configura las rutas necesarias en sys.path."""
    root_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), "."))
    if root_dir not in sys.path:
        sys.path.insert(0, root_dir)

    venv_site_packages = os.path.abspath(os.path.join(root_dir, ".venv", "Lib", "site-packages"))
    if venv_site_packages not in sys.path:
        sys.path.insert(0, venv_site_packages)

    src_dir = os.path.abspath(os.path.join(root_dir, ".venv", "src"))
    if src_dir not in sys.path:
        sys.path.insert(0, src_dir)

    # Ajustar rutas dinámicamente para módulos específicos
    for module in ["fusepy", "zstd", "numpy", "Pillow", "anytree"]:
        module_path = find_module_path(module, venv_site_packages)
        if module_path and module_path not in sys.path:
            sys.path.insert(0, module_path)
