fix command/path expansion
authorRichard Russon <rich@flatcap.org>
Fri, 3 Aug 2018 10:37:30 +0000 (11:37 +0100)
committerRichard Russon <rich@flatcap.org>
Fri, 3 Aug 2018 10:42:16 +0000 (11:42 +0100)
init.c

diff --git a/init.c b/init.c
index 6186eb531a92196705b01a2ac16b665e8bb602c8..6996999ce3ba107c84d378e2fdc638bb65148068 100644 (file)
--- a/init.c
+++ b/init.c
@@ -1746,13 +1746,31 @@ static int parse_set(struct Buffer *buf, struct Buffer *s, unsigned long data,
                   (url_check_scheme(scratch) == U_UNKNOWN)) /* probably a local file */
               {
                 struct ListNode *np = STAILQ_FIRST(&MuttrcStack);
-                if (!mutt_file_to_absolute_path(scratch, np ? NONULL(np->data) : "./"))
+                if (mutt_file_to_absolute_path(scratch, np ? NONULL(np->data) : "./"))
+                {
+                  mutt_buffer_reset(buf);
+                  mutt_buffer_addstr(buf, scratch);
+                }
+                else
                 {
                   mutt_error(_("Error: impossible to build path of '%s'."), scratch);
                 }
               }
             }
           }
+          else if (DTYPE(he->type) == DT_COMMAND)
+          {
+            char scratch[PATH_MAX];
+            mutt_str_strfcpy(scratch, buf->data, sizeof(scratch));
+            
+            if (mutt_str_strcmp(buf->data, "builtin") != 0)
+            {
+              mutt_expand_path(scratch, sizeof(scratch));
+            }
+            mutt_buffer_reset(buf);
+            mutt_buffer_addstr(buf, scratch);
+          }
+
           rc = cs_he_string_set(Config, he, buf->data, err);
           if (CSR_RESULT(rc) != CSR_SUCCESS)
             return -1;