BPackageWriter: Add SetCheckLicenses()
The default is still "true", but now it is possible to disable the license check.
This commit is contained in:
@@ -48,6 +48,7 @@ public:
|
|||||||
~BPackageWriter();
|
~BPackageWriter();
|
||||||
|
|
||||||
status_t Init(const char* fileName, uint32 flags = 0);
|
status_t Init(const char* fileName, uint32 flags = 0);
|
||||||
|
void SetCheckLicenses(bool checkLicenses);
|
||||||
status_t AddEntry(const char* fileName, int fd = -1);
|
status_t AddEntry(const char* fileName, int fd = -1);
|
||||||
status_t Finish();
|
status_t Finish();
|
||||||
|
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ public:
|
|||||||
~PackageWriterImpl();
|
~PackageWriterImpl();
|
||||||
|
|
||||||
status_t Init(const char* fileName, uint32 flags);
|
status_t Init(const char* fileName, uint32 flags);
|
||||||
|
void SetCheckLicenses(bool checkLicenses);
|
||||||
status_t AddEntry(const char* fileName, int fd = -1);
|
status_t AddEntry(const char* fileName, int fd = -1);
|
||||||
status_t Finish();
|
status_t Finish();
|
||||||
|
|
||||||
@@ -147,6 +148,7 @@ private:
|
|||||||
StringCache fStringCache;
|
StringCache fStringCache;
|
||||||
|
|
||||||
BPackageInfo fPackageInfo;
|
BPackageInfo fPackageInfo;
|
||||||
|
bool fCheckLicenses;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,14 @@ BPackageWriter::Init(const char* fileName, uint32 flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
BPackageWriter::SetCheckLicenses(bool checkLicenses)
|
||||||
|
{
|
||||||
|
if (fImpl != NULL)
|
||||||
|
fImpl->SetCheckLicenses(checkLicenses);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
BPackageWriter::AddEntry(const char* fileName, int fd)
|
BPackageWriter::AddEntry(const char* fileName, int fd)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -455,7 +455,8 @@ PackageWriterImpl::PackageWriterImpl(BPackageWriterListener* listener)
|
|||||||
fDataBufferSize(2 * B_HPKG_DEFAULT_DATA_CHUNK_SIZE_ZLIB),
|
fDataBufferSize(2 * B_HPKG_DEFAULT_DATA_CHUNK_SIZE_ZLIB),
|
||||||
fRootEntry(NULL),
|
fRootEntry(NULL),
|
||||||
fRootAttribute(NULL),
|
fRootAttribute(NULL),
|
||||||
fTopAttribute(NULL)
|
fTopAttribute(NULL),
|
||||||
|
fCheckLicenses(true)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -484,6 +485,13 @@ PackageWriterImpl::Init(const char* fileName, uint32 flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
PackageWriterImpl::SetCheckLicenses(bool checkLicenses)
|
||||||
|
{
|
||||||
|
fCheckLicenses = checkLicenses;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
PackageWriterImpl::AddEntry(const char* fileName, int fd)
|
PackageWriterImpl::AddEntry(const char* fileName, int fd)
|
||||||
{
|
{
|
||||||
@@ -569,9 +577,11 @@ PackageWriterImpl::Finish()
|
|||||||
|
|
||||||
RegisterPackageInfo(PackageAttributes(), fPackageInfo);
|
RegisterPackageInfo(PackageAttributes(), fPackageInfo);
|
||||||
|
|
||||||
status_t result = _CheckLicenses();
|
if (fCheckLicenses) {
|
||||||
if (result != B_OK)
|
status_t result = _CheckLicenses();
|
||||||
return result;
|
if (result != B_OK)
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
if ((Flags() & B_HPKG_WRITER_UPDATE_PACKAGE) != 0)
|
if ((Flags() & B_HPKG_WRITER_UPDATE_PACKAGE) != 0)
|
||||||
_CompactHeap();
|
_CompactHeap();
|
||||||
|
|||||||
Reference in New Issue
Block a user