[SCM] Kaboom - Debian KDE 3->4 migration tool branch, master, updated. master/1.1.1-11-g6eb9a15

George Kiagiadakis gkiagia-guest at alioth.debian.org
Wed Jul 8 14:15:51 UTC 2009


The following commit has been merged in the master branch:
commit 6eb9a1593be19be1837690051ab72e1844fcc0a8
Author: George Kiagiadakis <kiagiadakis.george at gmail.com>
Date:   Wed Jul 8 17:14:58 2009 +0300

    Preserve directory permissions while copying.
---
 debian/changelog                  |    1 +
 diroperations/recursivedirjob.cpp |   13 +++++++++++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 6ef1a2a..2b389ef 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,7 @@ kaboom (1.1.2) UNRELEASED; urgency=low
   +++ Changes by George Kiagiadakis:
 
   * Bugfix: create the stamp's parent directory if it doesn't exist.
+  * Preserve directory permissions while copying.
 
   +++ Changes by Lisandro D. N. Pérez Meyer:
 
diff --git a/diroperations/recursivedirjob.cpp b/diroperations/recursivedirjob.cpp
index 3d7e8c2..1fe20fd 100644
--- a/diroperations/recursivedirjob.cpp
+++ b/diroperations/recursivedirjob.cpp
@@ -246,7 +246,9 @@ void RecursiveDirJobHelper::recursiveCpDir(const QString & sourcePath, const QSt
         }
     }
 
-    dest.mkdir(dest.absolutePath());
+    if ( dest.mkdir(dest.absolutePath()) ) {
+        QFile::setPermissions(destPath, QFile::permissions(sourcePath));
+    }
 
     QFileInfoList currentList = source.entryInfoList(dirFilters);
     QFileInfo currentItem;
@@ -289,13 +291,20 @@ void RecursiveDirJobHelper::recursiveCpDir(const QString & sourcePath, const QSt
             else if ( currentItem.isDir() )
             {
                 bool ok = false;
+                QFile::Permissions sourcePermissions = QFile::permissions(source.absoluteFilePath(currentName));
+
                 if ( !(ok = source.cd(currentName)) ) {
                     emit errorOccured(Error(Error::AccessDenied, source.absoluteFilePath(currentName)));
                 }
                 if ( ok && !dest.cd(currentName) ) {
                     //if the target dir doesn't exist, create it and try again.
-                    if ( !dest.mkdir(currentName) )
+                    if ( !dest.mkdir(currentName) ) {
                         emit errorOccured(Error(Error::MkdirFail, dest.absoluteFilePath(currentName)));
+                    }
+
+                    //preserve permissions of the directory
+                    QFile::setPermissions(dest.absoluteFilePath(currentName), sourcePermissions);
+
                     if ( !dest.cd(currentName) ) {
                          //quite impossible to happen
                         emit errorOccured(Error(Error::AccessDenied, dest.absoluteFilePath(currentName)));

-- 
Kaboom - Debian KDE 3->4 migration tool



More information about the pkg-kde-commits mailing list