Systemcluster / The-Witcher-3-Mod-manager

Mod manager for The Witcher 3 🗃

Home Page:https://www.nexusmods.com/witcher3/mods/2678

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use patool directly instead of pyunpack

Conquerix opened this issue · comments

Hello,
I had to modify the fetcher.py file is src/core not to use pyunpack and use patool directly.
I use NixOS and the way pyunpack calls patool (as a separate program and not via the API) makes it fundamentally incompatible with NixOS.
I replaced lines 268-269 in src/core/fetcher.py with:

import patoolib
patoolib.extract_archive(modPath, outdir=extractedDir)

And this way I could correctly extract the mods.
In hope that it will help anyone

Small edit to the modification:

import shutil
    if modPath.lower().endswith(".7z") or modPath.lower().endswith(".rar"):
        import patoolib
        patoolib.extract_archive(modPath, outdir=extractedDir)
    else:
        shutil.unpack_archive(modPath, extractedDir)

The previous code didn't handle zip files well