]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/lib/attr.c
Working directory pane in restore. Will get this into the stack next.
[bacula/bacula] / bacula / src / lib / attr.c
index 47a5ee1b9ed172652bc333dd6122b45f11a69394..0bfcb8ab54201e5ebc195578cff31d5ac89d7c53 100644 (file)
@@ -35,7 +35,7 @@
 
 #include "bacula.h"
 #include "jcr.h"
-
+#include "lib/breg.h"
 
 ATTR *new_attr()
 {
@@ -148,9 +148,30 @@ void build_attr_output_fnames(JCR *jcr, ATTR *attr)
     *   every filename if a prefix is supplied.
     *
     */
-   if (jcr->where[0] == 0) {
+
+   if (jcr->where_bregexp) { 
+      char *ret;
+      apply_bregexps(attr->fname, jcr->where_bregexp, &ret);
+      pm_strcpy(attr->ofname, ret);
+
+      if (attr->type == FT_LNKSAVED || attr->type == FT_LNK) {
+         /* Always add prefix to hard links (FT_LNKSAVED) and
+          *  on user request to soft links
+          */
+
+         if ((attr->type == FT_LNKSAVED || jcr->prefix_links)) {
+            apply_bregexps(attr->lname, jcr->where_bregexp, &ret);
+            pm_strcpy(attr->olname, ret);
+
+         } else {
+            pm_strcpy(attr->olname, attr->lname);
+         }
+      }
+      
+   } else if (jcr->where[0] == 0) {
       pm_strcpy(attr->ofname, attr->fname);
       pm_strcpy(attr->olname, attr->lname);
+
    } else {
       const char *fn;
       int wherelen = strlen(jcr->where);