[PC-BSD Commits] r17321 - pcbsd/current/src-qt4/life-preserver

svn at pcbsd.org svn at pcbsd.org
Tue Jun 19 11:03:43 PDT 2012


Author: kenmoore
Date: 2012-06-19 18:03:43 +0000 (Tue, 19 Jun 2012)
New Revision: 17321

Modified:
   pcbsd/current/src-qt4/life-preserver/lifePreserverUserExclude.cpp
Log:
Fix the new symbolic-link fixing routine for life-preserver. now it will properly allow wildcards such as * again



Modified: pcbsd/current/src-qt4/life-preserver/lifePreserverUserExclude.cpp
===================================================================
--- pcbsd/current/src-qt4/life-preserver/lifePreserverUserExclude.cpp	2012-06-19 17:52:54 UTC (rev 17320)
+++ pcbsd/current/src-qt4/life-preserver/lifePreserverUserExclude.cpp	2012-06-19 18:03:43 UTC (rev 17321)
@@ -65,17 +65,36 @@
 void pUserExclude::slotAddExclude()
 {
   QString newExclude = lineNewExclude->text();
-  //Check for symbolic links in the given path
+  if( newExclude.isEmpty() ){ return; } //Do nothing if nothing given
+
+  //Trim the file/wildcards off the end for the moment
+  bool wild = FALSE;
+  QString endfile;
+  if(!QFile::exists(newExclude)){
+    //file does not exists, probably a wildcard in the path
+    wild=TRUE;
+    endfile = newExclude.section("/",-1);  
+    newExclude.remove(endfile);
+  }
+
+  //Check and replace symbolic links in the given path
   QDir dir(newExclude);
   QString canonical = dir.canonicalPath(); //removes symbolic links (if any)
-  if(canonical != newExclude){
-    qDebug() << "Symbolic links detected in the given path:"<< newExclude;
-    qDebug() << " - Changing to real path:"<<canonical;
+  if(canonical != newExclude && !canonical.isEmpty()){
+    qDebug() << "Symbolic links detected in the given path:"<< newExclude+endfile;
+    qDebug() << " - Changing to real path:"<<canonical+"/"+endfile;
+
     newExclude = canonical;
   }
-  
-  if( ! newExclude.isEmpty() )
-    listExcludes->addItem(newExclude);
+
+  //Add the file/wildcards on the end again
+  if(wild){
+    if(!newExclude.endsWith("/")){ newExclude.append("/"); }
+    newExclude.append(endfile);
+  }
+
+  //Add it to the list
+  listExcludes->addItem(newExclude);
   lineNewExclude->clear();
 }
 



More information about the Commits mailing list