Skip to content

Commit

Permalink
FsArchive constructor can be empty
Browse files Browse the repository at this point in the history
  • Loading branch information
myst6re committed May 26, 2022
1 parent 6b76533 commit f0b54a9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions FsArchive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,11 @@ FsArchive::FsArchive(const QByteArray &fl_data, const QByteArray &fi_data)
}

FsArchive::FsArchive(const QString &path)
: fromFile(true), _isOpen(false)
: fromFile(false), _isOpen(false)
{
load(path);
if (!path.isEmpty()) {
open(path);
}
}

FsArchive::~FsArchive()
Expand Down Expand Up @@ -942,7 +944,7 @@ bool FsArchive::load(const QByteArray &fl_data, const QByteArray &fi_data)
return true;
}

bool FsArchive::load(const QString &path)
bool FsArchive::open(const QString &path)
{
if(_isOpen) return false;

Expand Down
4 changes: 2 additions & 2 deletions FsArchive.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,10 @@ class FsArchive

// FsArchive();
FsArchive(const QByteArray &fl_data, const QByteArray &fi_data);
explicit FsArchive(const QString &path);
explicit FsArchive(const QString &path = QString());
virtual ~FsArchive();

bool open(const QString &path);
void addFile(const QString &path, FiCompression compression);
FsHeader *getFile(const QString &path) const;
void fileToTheEnd(const QString &path, QByteArray &fs_data);
Expand Down Expand Up @@ -145,7 +146,6 @@ class FsArchive
static QStringList listDirsRec(QDir *sourceDir);

bool load(const QByteArray &fl_data, const QByteArray &fi_data);
bool load(const QString &path);

static bool searchData(const QMultiMap<quint32, FsHeader *> &headers,
QFile *fs, const QByteArray &data, quint32 &pos);
Expand Down

0 comments on commit f0b54a9

Please sign in to comment.