From 5e89b1eec1f07545d79d3d35cb454c5998b9e70f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E6=B0=91=E5=8B=87?= Date: Tue, 13 Sep 2022 14:56:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E6=9C=89=E9=97=AE=E9=A2=98?= =?UTF-8?q?=EF=BC=8C=E5=86=8D=E6=AC=A1=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backup-daemon/systemrestoreproxy.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/backup-daemon/systemrestoreproxy.cpp b/backup-daemon/systemrestoreproxy.cpp index 850e541..650dd31 100755 --- a/backup-daemon/systemrestoreproxy.cpp +++ b/backup-daemon/systemrestoreproxy.cpp @@ -394,8 +394,12 @@ void SystemRestoreProxy::restoreSystem() QStringList SystemRestoreProxy::getBackupPointUsers() { // 根据备份点里的/home或/data/home的子目录进行统计 - QStringList users = getBackupPointUsers(m_backupPath + "/home"); - users.append(getBackupPointUsers(m_backupPath + "/data/home")); + QString homePath = m_backupPath + "/home"; + homePath.replace("//","/"); + QStringList users = getBackupPointUsers(homePath); + QString dataHomePath = m_backupPath + "/data/home"; + dataHomePath.replace("//","/"); + users.append(getBackupPointUsers(dataHomePath)); return users; } @@ -416,9 +420,12 @@ QStringList SystemRestoreProxy::getBackupPointUsers(const QString& path) */ void SystemRestoreProxy::removeHome(const QString& path) { + qDebug() << "SystemRestoreProxy::removeHome invoke begin"; + QDir dir(path); if (dir.exists()) { - QStringList retainUsers = getBackupPointUsers(m_backupPath + path); + QStringList retainUsers = getBackupPointUsers(); + qDebug() << retainUsers; bool needRm = false; QString subcmd("rm -rf "); @@ -426,6 +433,8 @@ void SystemRestoreProxy::removeHome(const QString& path) QStringList list = dir.entryList(QDir::NoDotAndDotDot | QDir::Dirs); for (const QString& item : list) { // 出厂备份里面的/home/oem等保留 + if (item == "oem") + continue ; if (retainUsers.contains(item)) continue ; @@ -450,4 +459,6 @@ void SystemRestoreProxy::removeHome(const QString& path) QProcess::execute(cmd); } } + + qDebug() << "SystemRestoreProxy::removeHome invoke end"; }