This macro is used when handling directories with OPEN_MENU, e.g., to list
available image files for setting the workspace background.

When parsing a menu file, we replace any instances of #usergnusteppath#
with either GNUSTEP_USER_ROOT or ~/GNUstep if the former is not set.  In
this way, authors of menu files do not have to worry about whether users
will have this variable set or not.

We also document this feature in WindowMaker/menu.in, which generates the
default English language old-style menu and currently contains the existing
documentation for the Window Maker menu system.
---
 WindowMaker/menu.in | 5 +++++
 src/rootmenu.c      | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/WindowMaker/menu.in b/WindowMaker/menu.in
index 429f8bec..f8a209c8 100644
--- a/WindowMaker/menu.in
+++ b/WindowMaker/menu.in
@@ -74,6 +74,11 @@
  *                     -noext  strip whatever is after the last dot in the
  *                             file name
  *
+ *      // Use #usergnusteppath# as a placeholder for the path to the user
+ *      // GNUstep directory.  Window Maker will replace this with the value
+ *      // of GNUSTEP_USER_ROOT, if this environment variable is set, or
+ *      // "~/GNUstep" otherwise
+ *
  * <Parameters> is the program to execute.
  *
  * ** Options for command line in EXEC:
diff --git a/src/rootmenu.c b/src/rootmenu.c
index 77b05a2a..fc8774e0 100644
--- a/src/rootmenu.c
+++ b/src/rootmenu.c
@@ -673,6 +673,11 @@ static void constructMenu(WMenu * menu, WMenuEntry * entry)
                                }
 
                                tmp = wexpandpath(path[i]);
+
+                               if (strstr(tmp, "#usergnusteppath#") == tmp)
+                                       tmp = wstrconcat(wusergnusteppath(),
+                                                         tmp + 17);
+
                                wfree(path[i]);
                                lpath = getLocalizedMenuFile(tmp);
                                if (lpath) {
-- 
2.11.0


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.

Reply via email to