[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/KDE/3.5/kdelibs/kio/kio
From:       Thomas McGuire <mcguire () kde ! org>
Date:       2009-12-01 11:45:46
Message-ID: 1259667946.595523.20214.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1057062 by tmcguire:

Support writing empty directories to ZIP files.


 M  +12 -1     kzip.cpp  
 M  +1 -4      kzip.h  


--- branches/KDE/3.5/kdelibs/kio/kio/kzip.cpp #1057061:1057062
@@ -1051,6 +1051,17 @@
     return true;
 }
 
+bool KZip::writeDir(const QString& name, const QString& user, const QString& 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 '/'. +    QString dirName = name;
+    if (!name.endsWith("/"))
+        dirName = dirName.append('/');
+    return writeFile(dirName, user, group, 0, 0);
+}
+
 // Doesn't need to be reimplemented anymore. Remove for KDE-4.0
 bool KZip::writeFile( const QString& name, const QString& user, const QString& \
group, uint size, const char* data )  {
@@ -1114,7 +1125,7 @@
     }
 
     // delete entries in the filelist with the same filename as the one we want
-    // to save, so that we don´t have duplicate file entries when viewing the zip
+    // to save, so that we don�t have duplicate file entries when viewing the zip
     // with konqi...
     // CAUTION: the old file itself is still in the zip and won't be removed !!!
     QPtrListIterator<KZipFileEntry> it( d->m_fileList );
--- branches/KDE/3.5/kdelibs/kio/kio/kzip.h #1057061:1057062
@@ -191,10 +191,7 @@
     /// Closes the archive
     virtual bool closeArchive();
 
-    /**
-     * @internal Not needed for zip
-     */
-    virtual bool writeDir( const QString& name, const QString& user, const QString& \
group) { Q_UNUSED(name); Q_UNUSED(user); Q_UNUSED(group); return true; } +    virtual \
bool writeDir(const QString& name, const QString& user, const QString& group);  // \
TODO(BIC) uncomment and make virtual for KDE 4.  //    bool writeDir( const QString& \
name, const QString& user, const QString& group,  //                        mode_t \
perm, time_t atime, time_t mtime, time_t ctime );


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic