]> git.sur5r.net Git - bacula/bacula/commitdiff
A bug was introduced in with commit 5727. Restoretree and restore were
authorDirk H Bartley <dbartley@schupan.com>
Sat, 31 May 2008 21:21:28 +0000 (21:21 +0000)
committerDirk H Bartley <dbartley@schupan.com>
Sat, 31 May 2008 21:21:28 +0000 (21:21 +0000)
after that commit using a subroutine in pages to determine if a path was
a win32 path.  The restore class was sending "/c:/" and restoretree was
sending "c:/".  The subroutine was working for "c:/"  This should fix it
and should also resolve the performance issue.  I'm a little concerned
because I love regexes that maybe a regex would be better, but I'll try
this for a bit to see if all works correctly.

git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@7076 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/qt-console/pages.cpp
bacula/src/qt-console/restore/restore.cpp

index d8da0986caa933fe9cf5800235ecb198fb815987..173f7fbf3cc9c3094e33470c4e468d5035f9987b 100644 (file)
@@ -39,7 +39,15 @@ bool isWin32Path(QString &fullPath)
 {
    char *buf = fullPath.left(2).toUtf8().data();
 
-   return buf[1] == ':' && B_ISALPHA(buf[0]);
+   //bool toret = B_ISALPHA(buf[1]);
+   bool toret = buf[1] == ':' && B_ISALPHA(buf[0]);
+   if (mainWin->m_miscDebug) {
+      if (toret)
+         Pmsg1(000, "returning from isWin32Path true %s\n", fullPath.toUtf8().data());
+      else
+         Pmsg1(000, "returning from isWin32Path false %s\n", fullPath.toUtf8().data());
+   }
+   return toret;
 }
 
 
index 25187d9193ae7e4dfb3ae9a2db2d62904267ff5a..4da3efde3fa69f50435f0587845e5cd6b1a61b1a 100644 (file)
@@ -186,33 +186,36 @@ void restorePage::addDirectory(QString &newdirr)
    bool windrive = false;
 
    if (mainWin->m_miscDebug) {
-      QString msg = QString(tr("In addDirectory cwd \"%1\" newdir \"%2\"\n"))
+      QString msg = QString(tr("In addDirectory cwd \"%1\" newdir \"%2\" fullpath \"%3\"\n"))
                     .arg(m_cwd)
-                    .arg(newdir);
+                    .arg(newdir)
+                    .arg(fullpath);
       Pmsg0(000, msg.toUtf8().data());
    }
 
    /* add unix '/' directory first */
-   if (m_dirPaths.empty() && !isWin32Path(fullpath)) {
-      QTreeWidgetItem *item = new QTreeWidgetItem(directoryWidget);
-      item->setIcon(0,QIcon(QString::fromUtf8(":images/folder.png")));
-      
-      QString text("/");
-      item->setText(0, text.toUtf8().data());
-      if (mainWin->m_miscDebug) {
-         Pmsg1(000, "Pre Inserting %s\n",text.toUtf8().data());
+   if (m_dirPaths.empty()) {
+      if (isWin32Path(newdir)) {
+         /* this is a windows drive */
+         if (mainWin->m_miscDebug) {
+            Pmsg0(000, "Need to do windows \"letter\":/\n");
+         }
+         fullpath.replace(0,1,"");
+         windrive = true;
+      } else {
+         QTreeWidgetItem *item = new QTreeWidgetItem(directoryWidget);
+         item->setIcon(0,QIcon(QString::fromUtf8(":images/folder.png")));
+         
+         QString text("/");
+         item->setText(0, text.toUtf8().data());
+         if (mainWin->m_miscDebug) {
+            Pmsg1(000, "Pre Inserting %s\n",text.toUtf8().data());
+         }
+         m_dirPaths.insert(text, item);
+         m_dirTreeItems.insert(item, text);
       }
-      m_dirPaths.insert(text, item);
-      m_dirTreeItems.insert(item, text);
    }
 
-   if (isWin32Path(fullpath)) {
-      /* this is a windows drive */
-      if (mainWin->m_miscDebug) {
-         Pmsg0(000, "Need to do windows \"letter\":/\n");
-      }
-      windrive = true;
-   }
  
    /* is it already existent ?? */
    if (!m_dirPaths.contains(fullpath)) {