Pidgeot / python-lnp

Cross-platform re-implementation of the Lazy Newb Pack launcher.
ISC License
64 stars 10 forks source link

Incomplete extraction into Baselines #192

Open txtsd opened 1 year ago

txtsd commented 1 year ago

When a baseline does not exist, PyLNP downloads the appropriate zip to extract into the baselines folder.

However, I've found that it skips/fails to extract several important files like the .txt files in the init folder, even though they exist in the zip.

LNP/Baselines/df_47_05 ``` λ tree -a LNP/Baselines LNP/Baselines └── df_47_05 ├── data │   ├── announcement │   ├── art │   │   ├── curses_640x300.bmp │   │   ├── curses_640x300.png │   │   ├── curses_800x600.bmp │   │   ├── curses_800x600.png │   │   ├── curses_square_16x16.bmp │   │   ├── curses_square_16x16.png │   │   ├── font license.txt │   │   ├── font.ttf │   │   ├── mouse.bmp │   │   └── mouse.png │   ├── dipscript │   │   └── text │   ├── help │   ├── init │   │   └── macros │   ├── initial_movies │   ├── movies │   ├── readme.txt │   ├── sound │   └── speech │   ├── ab_specific_hf_seeker.txt │   ├── animal_slayer.txt │   ├── arch_info_justification.txt │   ├── child_age_proclamation.txt │   ├── current_profession_no_year.txt │   ├── current_profession_year.txt │   ├── curse.txt │   ├── dwarf.txt │   ├── elf.txt │   ├── family_relationship_additional_dead.txt │   ├── family_relationship_additional.txt │   ├── family_relationship_no_spec_dead.txt │   ├── family_relationship_no_spec.txt │   ├── family_relationship_spec_dead.txt │   ├── family_relationship_spec.txt │   ├── general.txt │   ├── goodbye_worship_1.txt │   ├── goodbye_worship_2.txt │   ├── goodbye_worship_3.txt │   ├── greet_baby.txt │   ├── greet_reply_after_hero.txt │   ├── greet_reply_diff_language.txt │   ├── greet_reply.txt │   ├── greet_reply_unusual_first.txt │   ├── greet.txt │   ├── greet_worship.txt │   ├── guard_profession.txt │   ├── guard_warning.txt │   ├── hist_fig_slayer.txt │   ├── hunting_profession.txt │   ├── hunting_profession_year.txt │   ├── justification_antithetical.txt │   ├── justification_experience.txt │   ├── justification_proximity.txt │   ├── justification_reminder.txt │   ├── justification_representation.txt │   ├── lair_hunter_minotaur.txt │   ├── mercenary_profession.txt │   ├── mercenary_profession_year.txt │   ├── no_family.txt │   ├── past_hunting_profession.txt │   ├── past_mercenary_profession.txt │   ├── past_profession_no_year.txt │   ├── past_profession_year.txt │   ├── past_snatcher_profession.txt │   ├── past_thief_profession.txt │   ├── past_wandering_profession.txt │   ├── positive.txt │   ├── same_site_ab_specific_hf_seeker.txt │   ├── same_site_specific_hf_seeker.txt │   ├── site_specific_hf_seeker.txt │   ├── slayer.txt │   ├── snatcher_profession.txt │   ├── snatcher_profession_year.txt │   ├── soldier_profession.txt │   ├── task_recommendation.txt │   ├── temple_already_member.txt │   ├── temple_become_member.txt │   ├── thief_profession.txt │   ├── thief_profession_year.txt │   ├── threat.txt │   ├── unknown_hf_seeker.txt │   ├── wandering_profession.txt │   └── wandering_profession_year.txt ├── raw │   ├── graphics │   │   ├── example │   │   │   └── dwarves.bmp │   │   └── graphics_example.txt │   ├── interaction examples │   │   ├── example - bogeyman transformation.txt │   │   ├── example - shrine effects.txt │   │   ├── interaction_disturbance.txt │   │   ├── interaction_region.txt │   │   ├── interaction_secret.txt │   │   ├── interaction_underground_special.txt │   │   ├── interaction_vampire.txt │   │   └── interaction_werebeast.txt │   ├── objects │   │   ├── b_detail_plan_default.txt │   │   ├── body_default.txt │   │   ├── body_rcp.txt │   │   ├── building_custom.txt │   │   ├── creature_amphibians.txt │   │   ├── creature_annelids.txt │   │   ├── creature_birds_new.txt │   │   ├── creature_birds.txt │   │   ├── creature_bug_slug_new.txt │   │   ├── creature_desert_new.txt │   │   ├── creature_domestic.txt │   │   ├── creature_equipment.txt │   │   ├── creature_fanciful.txt │   │   ├── creature_insects.txt │   │   ├── creature_large_mountain.txt │   │   ├── creature_large_ocean.txt │   │   ├── creature_large_riverlake.txt │   │   ├── creature_large_temperate.txt │   │   ├── creature_large_tropical.txt │   │   ├── creature_large_tundra.txt │   │   ├── creature_mountain_new.txt │   │   ├── creature_next_underground.txt │   │   ├── creature_ocean_new.txt │   │   ├── creature_other.txt │   │   ├── creature_reptiles.txt │   │   ├── creature_riverlakepool_new.txt │   │   ├── creature_small_mammal_new.txt │   │   ├── creature_small_mammals.txt │   │   ├── creature_small_ocean.txt │   │   ├── creature_small_riverlake.txt │   │   ├── creature_standard.txt │   │   ├── creature_subterranean.txt │   │   ├── creature_temperate_new.txt │   │   ├── creature_tropical_new.txt │   │   ├── creature_tundra_taiga_new.txt │   │   ├── c_variation_default.txt │   │   ├── descriptor_color_standard.txt │   │   ├── descriptor_pattern_iris_eye.txt │   │   ├── descriptor_pattern_pupil_eye.txt │   │   ├── descriptor_pattern_special.txt │   │   ├── descriptor_shape_standard.txt │   │   ├── entity_default.txt │   │   ├── examples and notes │   │   │   ├── gaits.txt │   │   │   ├── item_instrument_example.txt │   │   │   └── reaction_instrument_example.txt │   │   ├── inorganic_metal.txt │   │   ├── inorganic_other.txt │   │   ├── inorganic_stone_gem.txt │   │   ├── inorganic_stone_layer.txt │   │   ├── inorganic_stone_mineral.txt │   │   ├── inorganic_stone_soil.txt │   │   ├── interaction_standard.txt │   │   ├── item_ammo.txt │   │   ├── item_armor.txt │   │   ├── item_food.txt │   │   ├── item_gloves.txt │   │   ├── item_helm.txt │   │   ├── item_pants.txt │   │   ├── item_shield.txt │   │   ├── item_shoes.txt │   │   ├── item_siegeammo.txt │   │   ├── item_tool.txt │   │   ├── item_toy.txt │   │   ├── item_trapcomp.txt │   │   ├── item_weapon.txt │   │   ├── language_DWARF.txt │   │   ├── language_ELF.txt │   │   ├── language_GOBLIN.txt │   │   ├── language_HUMAN.txt │   │   ├── language_SYM.txt │   │   ├── language_words.txt │   │   ├── material_template_default.txt │   │   ├── plant_crops.txt │   │   ├── plant_garden.txt │   │   ├── plant_grasses.txt │   │   ├── plant_new_trees.txt │   │   ├── plant_standard.txt │   │   ├── reaction_adv_carpenter.txt │   │   ├── reaction_other.txt │   │   ├── reaction_smelter.txt │   │   ├── text │   │   │   ├── book_art.txt │   │   │   ├── book_instruction.txt │   │   │   └── secret_death.txt │   │   └── tissue_template_default.txt │   └── readme.txt ├── readme.txt └── sdl 21 directories, 171 files ```

This causes loading keybinds to fail like so:

λ python launch.py
INFO: Registering path root as .
INFO: Registering path lnp as ./LNP
INFO: Registering path keybinds as ./LNP/Keybinds
INFO: Registering path graphics as ./LNP/Graphics
INFO: Registering path utilities as ./LNP/Utilities
INFO: Registering path colors as ./LNP/Colors
INFO: Registering path embarks as ./LNP/Embarks
INFO: Registering path tilesets as ./LNP/Tilesets
INFO: Registering path baselines as ./LNP/Baselines
INFO: Registering path mods as ./LNP/Mods
INFO: Registering path df as ./Dwarf Fortress df_47_05_linux
INFO: Registering path data as ./Dwarf Fortress df_47_05_linux/data
INFO: Registering path init as ./Dwarf Fortress df_47_05_linux/data/init
INFO: Registering path save as ./Dwarf Fortress df_47_05_linux/data/save
INFO: Registering path extras as ./LNP/Extras
INFO: Registering path defaults as ./LNP/Defaults
INFO: Registering path dfhack_config as ./Dwarf Fortress df_47_05_linux/dfhack-config/init
WARNING: Field PRIESTHOOD_UNIT_COUNTS seems to be missing from file ./Dwarf Fortress df_47_05_linux/data/init/d_init.txt!
WARNING: Field GUILD_UNIT_COUNTS seems to be missing from file ./Dwarf Fortress df_47_05_linux/data/init/d_init.txt!
WARNING: Can't load or change keybinds with missing baseline!
INFO: Read installed graphics (Phoebus) from log
INFO: Extracting archives in baselines: ['./LNP/Baselines/df_47_05_win_s.zip']
INFO: Simplifying baselines: df_47_05
INFO: Loading keybinds:  ./LNP/Keybinds/Laptop with mouse.txt
Exception in Tkinter callback
Traceback (most recent call last):
  File "/home/txtsd/.pyenv/versions/3.7.14/lib/python3.7/tkinter/__init__.py", line 1705, in __call__
    return self.func(*args)
  File "/home/txtsd/git/python-lnp/tkgui/options.py", line 129, in <lambda>
    self.keybinding_files.bind(seq, lambda e: self.load_keybinds())
  File "/home/txtsd/git/python-lnp/tkgui/options.py", line 283, in load_keybinds
    keybinds.load_keybinds(listbox.get(items[0]))
  File "/home/txtsd/git/python-lnp/core/keybinds.py", line 99, in load_keybinds
    _sdl_write_binds(target, _sdl_get_binds(filename), expanded=True)
  File "/home/txtsd/git/python-lnp/core/keybinds.py", line 51, in _sdl_get_binds
    van = _get_vanilla_binds()
  File "/home/txtsd/git/python-lnp/core/keybinds.py", line 81, in _get_vanilla_binds
    return _sdl_get_binds(vanfile, compressed=False)
  File "/home/txtsd/git/python-lnp/core/keybinds.py", line 41, in _sdl_get_binds
    with open(filename, encoding='cp437') as f:
FileNotFoundError: [Errno 2] No such file or directory: './LNP/Baselines/df_47_05/data/init/interface.txt'

This happens on master with Python 3.7.x as well as 3.10.x

txtsd commented 1 year ago

Seems like #163 and #186 are basically this same problem.