Skip to content

Commit

Permalink
Fix extraction of Grass Precache mods
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
cyberrumor committed Mar 23, 2024
1 parent 8cbb4ad commit 1e7647f
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 34 deletions.
21 changes: 21 additions & 0 deletions ammo/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 6 additions & 18 deletions ammo/mod_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@
ComponentEnum,
RenameEnum,
)
from .lib import normalize
from .lib import (
normalize,
NO_EXTRACT_DIRS,
)


@dataclass(frozen=True)
Expand Down Expand Up @@ -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"],
]
)
Expand Down
19 changes: 3 additions & 16 deletions ammo/tool_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
Download,
ToolEnum,
)
from .lib import NO_EXTRACT_DIRS


class ToolController(Controller):
Expand Down Expand Up @@ -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"],
]
)
Expand Down

0 comments on commit 1e7647f

Please sign in to comment.