Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
__init__.py35 linesDownload Raw Back to mitmproxy_windows
1from pathlib import Path2 3 4def executable_path() -> Path:5    """6    Return the Path for windows-redirector.exe.7 8    For shipped wheels this is just the file in the package,9    for development setups this may invoke cargo to build it.10    """11    here = Path(__file__).parent.absolute()12    exe = here / "windows-redirector.exe"13 14    # Development path: This should never happen with precompiled wheels.15    if not exe.exists() and (here / "../Cargo.toml").exists():16        import logging17        import shutil18        import subprocess19 20        logger = logging.getLogger(__name__)21        logger.warning("Development mode: Compiling windows-redirector.exe...")22 23        # Build Redirector24        subprocess.run(["cargo", "build"], cwd=here.parent / "redirector", check=True)25        # Copy WinDivert to target/debug/26        target_debug = here.parent.parent / "target/debug"27        for f in ["WinDivert.dll", "WinDivert.lib", "WinDivert64.sys"]:28            if not (target_debug / f).exists():29                shutil.copy(here / f, target_debug / f)30 31        logger.warning("Development mode: Using target/debug/windows-redirector.exe...")32        exe = target_debug / "windows-redirector.exe"33 34    return exe35 
codekingpro/portable-devtools · Team Ai