Pidgeot / python-lnp

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

Create mod subdirs when merging #180

Closed pjf closed 1 year ago

pjf commented 1 year ago

Description

When walking the list of files to merge from a mod, also try to create any subdirectories those files may be in.

Testing

Used PyLNP to install the HighFantasty mod. Without this change, an error is logged that files cannot be copied. With this change, the files copy across fine, and the merged changes can be applied.

Launched a game with the merged changes applied. Created a world. Started a fortress mode game, and observed that HighFantasty civs like dark gnomes and lizardfolk were active in the world.

This doesn't mean that HighFantasy installs flawlessly (it doesn't), but it no longer errors out from failing to copy files.

Other information

Thank you so much for PyLNP! It rocks!!

Closes #173

Pidgeot commented 1 year ago

I haven't officially dropped Python 2 compatibility at this point, and it doesn't have exist_ok - so please follow the pattern seen elsewhere in the file:

if not os.path.isdir(mixed_dir):
    os.makedirs(mixed_dir)

Feel free to also add yourself to the contributor list in tkgui/tkgui.py.

pjf commented 1 year ago

I haven't officially dropped Python 2 compatibility at this point, and it doesn't have exist_ok - so please follow the pattern seen elsewhere in the file:

Shall do, even though the Python Software Foundation has asked that Python 2 lives on in our hearts and memories, but not our codebases.

Feel free to also add yourself to the contributor list in tkgui/tkgui.py.

pjf commented 1 year ago

Requested changes made and branch updated. Thank you!!