diff --git a/changelog.md b/changelog.md index 05c246b..bbc7011 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,9 @@ # Changelog +## 2.0.1 +* Merge RosiaBaish's pull request: + * Add logic to allow mods with different special characters + ## 2.0.0 * Updated `factorio-data` to version `2.0.28` (latest) * Updated `compatibility/defines.lua` to `2.0.28` (latest) diff --git a/draftsman/data/entities.pkl b/draftsman/data/entities.pkl index 3dff7ba..d098dff 100644 Binary files a/draftsman/data/entities.pkl and b/draftsman/data/entities.pkl differ diff --git a/draftsman/data/fluids.pkl b/draftsman/data/fluids.pkl index 5e25c57..41cb5f9 100644 Binary files a/draftsman/data/fluids.pkl and b/draftsman/data/fluids.pkl differ diff --git a/draftsman/data/items.pkl b/draftsman/data/items.pkl index 7e991ed..f1b9555 100644 Binary files a/draftsman/data/items.pkl and b/draftsman/data/items.pkl differ diff --git a/draftsman/data/mods.pkl b/draftsman/data/mods.pkl index 3e90cdf..8b1b5d5 100644 Binary files a/draftsman/data/mods.pkl and b/draftsman/data/mods.pkl differ diff --git a/draftsman/data/modules.pkl b/draftsman/data/modules.pkl index da58ef3..ce5eb52 100644 Binary files a/draftsman/data/modules.pkl and b/draftsman/data/modules.pkl differ diff --git a/draftsman/data/planets.pkl b/draftsman/data/planets.pkl index b4e2ccf..266fb03 100644 Binary files a/draftsman/data/planets.pkl and b/draftsman/data/planets.pkl differ diff --git a/draftsman/data/recipes.pkl b/draftsman/data/recipes.pkl index 7cd77c4..ca6fa94 100644 Binary files a/draftsman/data/recipes.pkl and b/draftsman/data/recipes.pkl differ diff --git a/draftsman/data/signals.pkl b/draftsman/data/signals.pkl index a973286..942eabe 100644 Binary files a/draftsman/data/signals.pkl and b/draftsman/data/signals.pkl differ diff --git a/draftsman/data/tiles.pkl b/draftsman/data/tiles.pkl index ab734b9..7882622 100644 Binary files a/draftsman/data/tiles.pkl and b/draftsman/data/tiles.pkl differ diff --git a/draftsman/environment/mod_list.py b/draftsman/environment/mod_list.py index 0000912..369730c 100644 --- a/draftsman/environment/mod_list.py +++ b/draftsman/environment/mod_list.py @@ -259,12 +259,22 @@ def register_mod(mod_name, mod_location, mod_list_json={"mods": {}}): # If there's multiple, but one matches exactly, use that mod_folder = folder_name else: - # Otherwise, who knows! Fix your mods or update the wiki! - # Why do I always get the short end of the stick!? - raise IncorrectModFormatError( - "Mod archive '{}' has more than one internal folder, and " - "none of the internal folders match it's external name".format(mod_name) - ) + # Try a case insensitive alphanumeric only comparison, + # and succeed if we get exactly one hit. + dirs = list(topdirs) + simplified_dirs = [re.sub(r'[^a-zA-Z0-9]', '', s).lower() for s in dirs] + simplified_foldername = re.sub(r'[^a-zA-Z0-9]', '', folder_name).lower() + if simplified_dirs.count(simplified_foldername) == 1: + # we want the original folder, so get the index. + index = simplified_dirs.index(simplified_foldername) + mod_folder = dirs[index] + else: + # Otherwise, who knows! Fix your mods or update the wiki! + # Why do I always get the short end of the stick!? + raise IncorrectModFormatError( + "Mod archive '{}' has more than one internal folder, and " + "none of the internal folders match it's external name".format(mod_name) + ) try: # Zipfiles don't like backslashes on Windows, so we manually