Skip to content

Built-in archiver takes priority over custom archiver for a different format. #122

Description

@Fothsid

Title self-explanatory.

I have a custom archiver for AFS files, but I have to mount archives with both .AFS and .DAT extensions. I register it with PHYSFS_registerArchiver just for the .AFS extension. For .DAT files, the POD archiver seems to take priority for the files I mount.

Looking at the source code, the validity checks before claiming the archive seem very loose:

BAIL_IF_ERRPASS(!readui32(io, &dummy), 0);
BAIL_IF_ERRPASS(!__PHYSFS_readAll(io, description, 80), NULL);
if ((description[0] == 0) || (description[79] != 0)) // Check if we're lacking a description or last char isn't a null terminator.
    return NULL;

io->seek(io, 0);

*claimed = 1;

Currently I'm mitigating this in my project by manually disabling the POD archiver.

Usually I'd just submit a PR for this kind of thing, but I'm not sure what is the good solution here. Personally, I would've preferred an API change to be able to either append or prepend to the archiver list, just like how it is possible with search paths when mounting.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions