Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
  • Loading branch information
cen1 committed Sep 29, 2024
1 parent 8548c7e commit 74d6a48
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
8 changes: 4 additions & 4 deletions quazip/JlCompress.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ bool JlCompress::compressFile(QuaZip* zip, QString fileName, QString fileDest, c
zip->getMode()!=QuaZip::mdAdd) return false;

QuaZipFile outFile(zip);
if (options.dateTime().isNull()) {
if (options.getDateTime().isNull()) {
if(!outFile.open(QIODevice::WriteOnly, QuaZipNewInfo(fileDest, fileName))) return false;
}
else {
if(!outFile.open(QIODevice::WriteOnly, QuaZipNewInfo(fileDest, fileName, options.dateTime()))) return false;
if(!outFile.open(QIODevice::WriteOnly, QuaZipNewInfo(fileDest, fileName, options.getDateTime()))) return false;
}

QFileInfo input(fileName);
Expand Down Expand Up @@ -104,11 +104,11 @@ bool JlCompress::compressSubDir(QuaZip* zip, QString dir, QString origDir, bool
if (dir != origDir) {
QuaZipFile dirZipFile(zip);
std::unique_ptr<QuaZipNewInfo> qzni;
if (options.dateTime().isNull()) {
if (options.getDateTime().isNull()) {
qzni = std::make_unique<QuaZipNewInfo>(origDirectory.relativeFilePath(dir) + QLatin1String("/"), dir);
}
else {
qzni = std::make_unique<QuaZipNewInfo>(origDirectory.relativeFilePath(dir) + QLatin1String("/"), dir, options.dateTime());
qzni = std::make_unique<QuaZipNewInfo>(origDirectory.relativeFilePath(dir) + QLatin1String("/"), dir, options.getDateTime());
}
if (!dirZipFile.open(QIODevice::WriteOnly, *qzni, nullptr, 0, 0)) {
return false;
Expand Down
13 changes: 8 additions & 5 deletions quazip/JlCompress.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class QUAZIP_EXPORT JlCompress {
explicit Options(const QDateTime& dateTime = QDateTime())
: m_dateTime(dateTime) {}

QDateTime dateTime() const {
QDateTime getDateTime() const {
return m_dateTime;
}

Expand Down Expand Up @@ -79,7 +79,7 @@ class QUAZIP_EXPORT JlCompress {
\param zip Opened zip to compress the file to.
\param fileName The full path to the source file.
\param fileDest The full name of the file inside the archive.
\param dateTime Explicitly sets dateTime instead of using last modified of the input file. Useful if you need reproducible archives.
\param options Options for fixed file timestamp, compression level, encryption..
\return true if success, false otherwise.
*/
static bool compressFile(QuaZip* zip, QString fileName, QString fileDest, const Options& options);
Expand All @@ -102,6 +102,9 @@ class QUAZIP_EXPORT JlCompress {
\param parentDir The full path to the directory corresponding to
the root of the ZIP.
\param recursive Whether to pack sub-directories as well or only
\param filters what to pack, filters are applied both when searching
* for subdirs (if packing recursively) and when looking for files to pack
\param options Options for fixed file timestamp, compression level, encryption..
files.
\return true if success, false otherwise.
*/
Expand Down Expand Up @@ -133,7 +136,7 @@ class QUAZIP_EXPORT JlCompress {
/**
\param fileCompressed The name of the archive.
\param file The file to compress.
\param options Additional options such as fixed last modified time, encryption (tbd)
\param options Options for fixed file timestamp, compression level, encryption..
\return true if success, false otherwise.
*/
static bool compressFile(QString fileCompressed, QString file, const Options& options);
Expand All @@ -148,7 +151,7 @@ class QUAZIP_EXPORT JlCompress {
/**
\param fileCompressed The name of the archive.
\param files The file list to compress.
\param options Additional options such as fixed last modified time, encryption (tbd)
\param options Options for fixed file timestamp, compression level, encryption..
\return true if success, false otherwise.
*/
static bool compressFiles(QString fileCompressed, QStringList files, const Options& options);
Expand Down Expand Up @@ -195,7 +198,7 @@ class QUAZIP_EXPORT JlCompress {
* @param recursive if true, then the subdirectories are packed as well
* @param filters what to pack, filters are applied both when searching
* for subdirs (if packing recursively) and when looking for files to pack
* @param options Additional options such as fixed last modified time, encryption (tbd)
* @param options Options for fixed file timestamp, compression level, encryption..
* @return true on success, false otherwise
*/
static bool compressDir(QString fileCompressed, QString dir,
Expand Down
2 changes: 0 additions & 2 deletions quazip/quazipnewinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ struct QUAZIP_EXPORT QuaZipNewInfo {
* is inaccessible (e. g. you do not have read permission for the
* directory file in), uses current time and zero permissions. Other attributes are
* initialized with zeros, comment and extra field with null values.
*
* \sa setFileDateTime()
**/
QuaZipNewInfo(const QString& name, const QString& file);
Expand All @@ -104,7 +103,6 @@ struct QUAZIP_EXPORT QuaZipNewInfo {
* is inaccessible (e. g. you do not have read permission for the
* directory file in), uses zero permissions. Other attributes are
* initialized with zeros, comment and extra field with null values.
*
* \sa setFileDateTime()
**/
QuaZipNewInfo(const QString& name, const QString& file, const QDateTime& dateTime);
Expand Down

0 comments on commit 74d6a48

Please sign in to comment.