From 1e7647f30df5ccca2821f80880656f9f80319ec8 Mon Sep 17 00:00:00 2001 From: cyberrumor Date: Sat, 23 Mar 2024 11:37:10 -0600 Subject: [PATCH] Fix extraction of Grass Precache mods Fix extraction of mods like Grass Precache for Skyrim Vanilla Grass. Mods like these have a Grass folder that belongs under Data, but the Data folder isn't included in the mod. Previously ammo would elevate all of this mod's .cgid files above the Grass folder. Now those files will remain in the correct place. If you were previously using a mod that had only one folder at the top level which was either named (case insensitive) "grass", "seq" or "scripts", you should re-download and reinstall that mod. --- ammo/lib.py | 21 +++++++++++++++++++++ ammo/mod_controller.py | 24 ++++++------------------ ammo/tool_controller.py | 19 +++---------------- 3 files changed, 30 insertions(+), 34 deletions(-) diff --git a/ammo/lib.py b/ammo/lib.py index a12e873..5859267 100755 --- a/ammo/lib.py +++ b/ammo/lib.py @@ -2,6 +2,27 @@ from pathlib import Path +NO_EXTRACT_DIRS = [ + "skse", + "netscriptframework", + "bashtags", + "docs", + "meshes", + "textures", + "grass", + "animations", + "interface", + "strings", + "misc", + "shaders", + "sounds", + "voices", + "edit scripts", + "scripts", + "seq", +] + + def normalize(destination: Path, dest_prefix: Path) -> Path: """ Prevent folders with the same name but different case diff --git a/ammo/mod_controller.py b/ammo/mod_controller.py index d83585d..6dd4366 100755 --- a/ammo/mod_controller.py +++ b/ammo/mod_controller.py @@ -30,7 +30,10 @@ ComponentEnum, RenameEnum, ) -from .lib import normalize +from .lib import ( + normalize, + NO_EXTRACT_DIRS, +) @dataclass(frozen=True) @@ -840,23 +843,8 @@ def has_extra_folder(path) -> bool: [ len(files) == 1, files[0].is_dir(), - files[0].name.lower() - not in [ - self.game.data.name.lower(), - "skse", - "netscriptframework", - "bashtags", - "docs", - "meshes", - "textures", - "animations", - "interface", - "misc", - "shaders", - "sounds", - "voices", - "edit scripts", - ], + files[0].name.lower() != self.game.data.name.lower(), + files[0].name.lower() not in NO_EXTRACT_DIRS, files[0].suffix.lower() not in [".esp", ".esl", ".esm"], ] ) diff --git a/ammo/tool_controller.py b/ammo/tool_controller.py index e8bd8e4..0adbf73 100755 --- a/ammo/tool_controller.py +++ b/ammo/tool_controller.py @@ -24,6 +24,7 @@ Download, ToolEnum, ) +from .lib import NO_EXTRACT_DIRS class ToolController(Controller): @@ -283,22 +284,8 @@ def has_extra_folder(path) -> bool: [ len(files) == 1, files[0].is_dir(), - files[0].name.lower() - not in [ - self.tools_dir.name.lower(), - "skse", - "bashtags", - "docs", - "meshes", - "textures", - "animations", - "interface", - "misc", - "shaders", - "sounds", - "voices", - "edit scripts", - ], + files[0].name.lower() != self.tools_dir.name.lower(), + files[0].name.lower() not in NO_EXTRACT_DIRS, files[0].suffix.lower() not in [".esp", ".esl", ".esm"], ] )