quickmod/FuseMounter/fuseproxy.h
Daniel O'Neill 191cd5362a Lots of fixes, VFS now seems to work reliably. Still a lot of cleanup and shoring to do.
Decided to leave the VFS tab for now. Filtering likely doesn't work, except Show Only Open. Sorting works.
Rewrites to replace dynamicRoles done for Mods and Plugins tables.
Database.qml now reads "moddir", though installing extracted is still unimplemented so far.
Launch still doesn't work.
Ignore the "file -> test extract". It's a test for file extraction.
2025-11-10 13:15:26 -08:00

71 lines
2 KiB
C++

#ifndef FUSEPROXY_H
#define FUSEPROXY_H
#include <QFile>
#include <QList>
#include <QObject>
#include <QSqlDatabase>
#include <QString>
#include "fusebase.h"
typedef struct {
int modId;
int fileId;
QString basedir;
QString actual;
QString mapped;
QString lmapped;
QStringList lparts;
} FuseProxyMapping;
class FuseAccessorProxy : public FuseAccessorBase
{
Q_OBJECT
QList< FuseProxyMapping > m_entries;
public:
explicit FuseAccessorProxy(FuseInterface *parent, const QString &resource, e_fh_type type=FH_PROXY);
explicit FuseAccessorProxy(FuseInterface *parent, QList< FuseProxyMapping > entries);
virtual ~FuseAccessorProxy();
int getattr(const QString &path, struct stat *stbuf) override;
QStringList readdir(const QString &path) override;
FuseFHBase *open(const QString &path, QIODeviceBase::OpenMode mode) override;
QString fullPath(const QString &path);
QString resolvePath(const QString &root, const QString &path, bool justPath=false);
static QList<FuseProxyMapping> proxyList(QSqlDatabase &database, int profileId);
// This expects the new entry to be created, then return "write" on the opened handle, otherwise return the appropriate "write" error code.
int makeWritable(struct fuse_file_info *fi, const QString &path, QIODeviceBase::OpenMode mode, const QByteArray &data, off_t offset);
QList< FuseProxyMapping > &entries() { return m_entries; }
};
class FuseFHProxy : public FuseFHBase
{
Q_OBJECT
public:
explicit FuseFHProxy(FuseAccessorProxy *parent, const QString &path, const QString &newpath);
virtual ~FuseFHProxy();
const QString getResource() override;
bool open(QIODeviceBase::OpenMode mode) override;
QByteArray read(size_t size, off_t offset) override;
off_t lseek(off_t off, int whence) override;
int write(const QByteArray &data, off_t offset, fuse_file_info *fi) override;
void release() override;
QFile m_file;
};
#endif // FUSEPROXY_H