L0laapk3 / FactorioMaps

L0laapk3's FactorioMaps mod
https://mods.factorio.com/mod/L0laapk3_FactorioMaps
Other
118 stars 22 forks source link

fix for folder names without version #100

Closed suisseWalter closed 3 years ago

suisseWalter commented 3 years ago

potential fix for #99

it works in my space exploration file. but there might be other mods where it might crash.

saulrh commented 3 years ago

It looks like this might only work when all loaded mods leave the version off, otherwise it causes the opposite problem and folder names with the version crash:

Traceback (most recent call last):
  File "auto.py", line 880, in <module>
    auto(*sys.argv[1:])
  File "auto.py", line 804, in auto
    zipInfo = zipObj.getinfo(os.path.join(mod[0], icon + ".png").replace('\\', '/'))
  File "/usr/lib/python3.8/zipfile.py", line 1441, in getinfo
    raise KeyError(
KeyError: "There is no item named 'krastorio2/graphics/icons/fluids/oil.png' in the archive"
saul@enki ~/D/f/f/m/L0laapk3_FactorioMaps ((a63a1594…)) [1]> zipinfo -l ../../mods/Krastorio2_1.1.4.zip | grep oil.png
-rw-r--r--  4.5 unx    12174 bl    12179 defN 21-May-19 05:26 Krastorio2_1.1.4/graphics/icons/entities/tesla-coil.png
-rw-r--r--  4.5 unx     5794 bl     5799 defN 21-May-19 05:26 Krastorio2_1.1.4/graphics/icons/fluids/heavy-oil.png
-rw-r--r--  4.5 unx     6021 bl     6026 defN 21-May-19 05:26 Krastorio2_1.1.4/graphics/icons/fluids/light-oil.png
-rw-r--r--  4.5 unx     5117 bl     5122 defN 21-May-19 05:26 Krastorio2_1.1.4/graphics/icons/fluids/oil.png
-rw-r--r--  4.5 unx     2831 bl     2836 defN 21-May-19 05:26 Krastorio2_1.1.4/graphics/icons/resources/crude-oil.png
-rw-r--r--  4.5 unx    47598 bl    47546 defN 21-May-19 05:26 Krastorio2_1.1.4/graphics/resources/crude-oil.png
-rw-r--r--  4.5 unx    43888 bl    43903 defN 21-May-19 05:26 Krastorio2_1.1.4/graphics/technologies/matter-oil.png
-rw-r--r--  4.5 unx    36922 bl    36937 defN 21-May-19 05:26 Krastorio2_1.1.4/graphics/technologies/tesla-coil.png
L0laapk3 commented 3 years ago

Apparently this PR crashes for mods that do have a version in the folder name. The problem should probably be addressed at https://github.com/L0laapk3/FactorioMaps/blob/3479b2ac1285658d4dbfbc2e4b4a99b81d113544/auto.py#L741-L747 rather than trying to fix the symptoms. I'll try to have a look at it over the next days or if someone else wants to do it, feel free :p

L0laapk3 commented 3 years ago

I believe the --no-tags flag can be used as a workaround until this is addressed.

L0laapk3 commented 3 years ago

Closing in favor of #101 .