diff options
author | Thomas McGuire <mcguire@kde.org> | 2014-10-05 23:51:39 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2014-10-05 23:51:39 -0500 |
commit | ddbe23e90d6684548fe9a952b01b3d6cbaf60a7c (patch) | |
tree | 2f1578c58b71aa8dc03de729a210f280d980ae88 /tdeio/tdeio/kzip.cpp | |
parent | 03518d6339ad40346fdcf7ab4b66d8eb307a36a8 (diff) | |
download | tdelibs-ddbe23e90d6684548fe9a952b01b3d6cbaf60a7c.tar.gz tdelibs-ddbe23e90d6684548fe9a952b01b3d6cbaf60a7c.zip |
Support writing empty directories to ZIP files.
Diffstat (limited to 'tdeio/tdeio/kzip.cpp')
-rw-r--r-- | tdeio/tdeio/kzip.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tdeio/tdeio/kzip.cpp b/tdeio/tdeio/kzip.cpp index 23052ce51..91f36a085 100644 --- a/tdeio/tdeio/kzip.cpp +++ b/tdeio/tdeio/kzip.cpp @@ -1051,6 +1051,21 @@ bool KZip::closeArchive() return true; } +bool KZip::writeDir(const TQString& name, const TQString& user, const TQString& group) +{ + // Zip files have no explicit directories, they are implicitly created during extraction time + // when file entries have paths in them. + // However, to support empty directories, we must create a dummy file entry which ends with '/'. + TQString dirName = name; + if (!name.endsWith("/")) { + dirName = dirName.append('/'); + } + + mode_t perm = 040755; + time_t the_time = time(0); + return writeFile(dirName, user, group, 0, perm, the_time, the_time, the_time, 0); +} + // Doesn't need to be reimplemented anymore. Remove for KDE-4.0 bool KZip::writeFile( const TQString& name, const TQString& user, const TQString& group, uint size, const char* data ) { |