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

List:       kde-commits
Subject:    branches/KDE/3.5/kdelibs/kio/kio
From:       David Faure <faure () kde ! org>
Date:       2007-09-21 20:18:35
Message-ID: 1190405915.360349.23736.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 715315 by dfaure:

Fix extraction of symlinks from tar/zip files when using copyTo() - at least at the \
KArchive level. Unit tests in trunk.
CCBUG: 149903


 M  +25 -15    karchive.cpp  


--- branches/KDE/3.5/kdelibs/kio/kio/karchive.cpp #715314:715315
@@ -626,22 +626,32 @@
     dirEntries = curDir->entries();
     for ( it = dirEntries.begin(); it != dirEntries.end(); ++it ) {
       curEntry = curDir->entry(*it);
-      if ( curEntry->isFile() ) {
-        curFile = dynamic_cast<KArchiveFile*>( curEntry );
-	if (curFile) {
-          fileList.append( curFile );
-          fileToDir.insert( curFile->position(), curDirName );
-        }
+      if (!curEntry->symlink().isEmpty()) {
+          const QString linkName = curDirName+'/'+curEntry->name();
+          kdDebug() << "symlink(" << curEntry->symlink() << ',' << linkName << ')';
+#ifdef Q_OS_UNIX
+          if (!::symlink(curEntry->symlink().local8Bit(), linkName.local8Bit())) {
+              kdDebug() << "symlink(" << curEntry->symlink() << ',' << linkName << \
") failed:" << strerror(errno); +          }
+#endif
+      } else {
+          if ( curEntry->isFile() ) {
+              curFile = dynamic_cast<KArchiveFile*>( curEntry );
+              if (curFile) {
+                  fileList.append( curFile );
+                  fileToDir.insert( curFile->position(), curDirName );
+              }
+          }
+
+          if ( curEntry->isDirectory() )
+              if ( recursiveCopy ) {
+                  KArchiveDirectory *ad = dynamic_cast<KArchiveDirectory*>( curEntry \
); +                  if (ad) {
+                      dirStack.push( ad );
+                      dirNameStack.push( curDirName + "/" + curEntry->name() );
+                  }
+              }
       }
-
-      if ( curEntry->isDirectory() )
-        if ( recursiveCopy ) {
-          KArchiveDirectory *ad = dynamic_cast<KArchiveDirectory*>( curEntry );
-          if (ad) {
-            dirStack.push( ad );
-            dirNameStack.push( curDirName + "/" + curEntry->name() );
-          }
-        }
     }
   } while (!dirStack.isEmpty());
 


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

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