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

Fix file sizes in the data tab (WIP) #1453

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

isanae
Copy link
Contributor

@isanae isanae commented Mar 6, 2021

The bug was that if a file had an origin from an archive, the size from the archive was always shown even if the conflict was won by another mod.

When a file from disk is added for the first time to the register (in DirectoryEntry::onFile()), its file size is NoFileSize by default because it's not available. This is forwarded to the Data tab, which will get the size on disk of the file the first time it's shown in the tree. However, if one of the origins of the file is from an archive, bsatk helpfully gives the size, so that's added to the register (see DirectoryEntry::addFiles(), not in diff below).

The problem was that if another origin was added that has a higher prio, that file size from the BSA was never cleared to NoFileSize, which prevented the Data tab from getting the size on disk and always displayed the size from the BSA.

So the file size is now set to NoFileSize when adding a file from the disk. This clears whatever size might be have been set if a previous origin was from an archive.

I also removed Cached::override(), I'm not sure what the purpose was (yes, I wrote it). It looks like it was to prevent fetching the file size again if it was available from a BSA, but it makes no sense and would prevent the file size from being updated ever again even if the winning origin of a file changed. So that's gone too.

Fixes #1454.

- bug: if a file had an origin from an archive, the size from the archive was always shown even if the conflict was won by another mod
- so, set the file size to NoFileSize when adding a file from the disk, this clears whatever size might be have been set if a previous origin was from an archive
- also remove Cached::override(), not sure what the purpose was, looks like it was to prevent fetching the file size again, but it makes no sense and would prevent the file size from being updated ever again even if the winning origin of a file changed
@isanae isanae added this to the 2.4.1 milestone Mar 6, 2021
@isanae isanae changed the title Fix file sizes in the data tab Fix file sizes in the data tab (WIP) Mar 6, 2021
@isanae
Copy link
Contributor Author

isanae commented Mar 6, 2021

This doesn't work if the BSA comes later in the mod order, it still sets the cached size. I'll check it out tomorrow.

@Holt59 Holt59 modified the milestones: 2.4.1, 2.4.2 Mar 12, 2021
@isanae isanae removed this from the 2.4.2 milestone Apr 26, 2021
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 this pull request may close these issues.

Incorrect file sizes in the Data tab
2 participants