Android: Support content:// URI in love.filesystem.mountFullPath.

This commit is contained in:
Miku AuahDark
2025-01-16 17:06:03 +08:00
parent cb27e30879
commit bff50070c6
@@ -398,6 +398,25 @@ bool Filesystem::mountFullPath(const char *archive, const char *mountpoint, Moun
std::string canonarchive = canonicalizeRealPath(archive);
#ifdef LOVE_ANDROID
if (strncmp(archive, "content://", 10) == 0)
{
if (permissions == MOUNT_PERMISSIONS_READWRITE)
// Currently there's no way content:// URIs we got are for read-write.
// TODO: Re-evaluate this in the future, maybe?
return false;
auto io = (PHYSFS_Io *) love::android::getIOFromContentProtocol(archive);
if (!io)
return false;
if (PHYSFS_mountIo(io, canonarchive.c_str(), mountpoint, appendToPath))
return true;
io->destroy(io);
}
#endif
if (permissions == MOUNT_PERMISSIONS_READWRITE)
return PHYSFS_mountRW(canonarchive.c_str(), mountpoint, appendToPath) != 0;