Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installer cannot return multiple directory paths with same destination #15

Open
krateng opened this issue Oct 23, 2022 · 1 comment · May be fixed by #17
Open

Installer cannot return multiple directory paths with same destination #15

krateng opened this issue Oct 23, 2022 · 1 comment · May be fixed by #17

Comments

@krateng
Copy link

krateng commented Oct 23, 2022

This happens on multiple mods, but just as an example, I have the fomod Bijin Wives. The ModuleConfig.xml file is properly parsed to install multiple paths for one option:

mod = pyfomod.parse((None,"./ModuleConfig.xml"))

page1 = mod.pages[0]
group1 = page1[0]
option1 = group1[0]
print(option1.name)
# All IN ONE
print(option1.files)
# <pyfomod.fomod.Files object at 0x7f2d77c68b80>
print(list(option1.files))
# ['02 ESPs\\AIO/', '00 Common/', '01 Characters\\Camilla/', '01 Characters\\Grelka/', '01 Characters\\Morwen/', '01 Characters\\Muiri/', '01 Characters\\Senna/', '01 Characters\\Sylgja/', '01 Characters\\Taarie/', '01 Characters\\Temba/', '01 Characters\\Ysolda/']

However, when I actually select that option with the installer, it only remembers the last path:

mod = pyfomod.parse((None,"./ModuleConfig.xml"))
installer = pyfomod.Installer(mod)

page1 = installer.next()
group1 = page1[0]
option1 = group1[0]
print(option1.name)
# All IN ONE
installer.next([option1])
print(installer.files())
# {'01 Characters\\Ysolda': '.'}

From multiple test cases, this seems to be always the last file added - and not just per page or group, but over the entire installer.

@krateng
Copy link
Author

krateng commented Oct 24, 2022

I did some digging through the code and I'm not sure I fully understand it, but it seems the source -> destination file dict is first built in reverse (as a destination -> source dict)

https://github.com/GandaG/pyfomod/blob/9c27b5c3a5a661233d99c6caa4110ac74d9cd72c/src/pyfomod/installer.py#L267-L276

This leads to paths with duplicate destinations being ignored, which breaks if the fomod uses directory destinations (copying whole directories instead of individual files).

Removing that whole logic fixes the issue, but obviously breaks the priority calculation.

@krateng krateng changed the title Installer only returns one file Installer cannot return multiple directory paths with same destination Oct 25, 2022
@krateng krateng linked a pull request Oct 25, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant