From 5b81559ea505a358beaf0de4d9f35f1c55cbae0b Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Mon, 4 Apr 2011 21:39:51 +0000 Subject: made [helplink] search the canvas-local path first, then try global helppath svn path=/trunk/externals/pddp/; revision=15054 --- helplink.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/helplink.c b/helplink.c index db70f25..46b2d93 100644 --- a/helplink.c +++ b/helplink.c @@ -136,7 +136,25 @@ static t_widgetbehavior helplink_widgetbehavior = static void helplink_click(t_helplink *x, t_floatarg xpos, t_floatarg ypos, t_floatarg shift, t_floatarg ctrl, t_floatarg alt) { - open_via_helppath(x->x_ulink->s_name, canvas_getdir(x->x_glist)->s_name); + char* objectname = x->x_ulink->s_name; + char helpname[MAXPDSTRING]; + char dirbuf[MAXPDSTRING], *nameptr; + int fd = canvas_open(x->x_glist, objectname, "-help.pd", + dirbuf, &nameptr, MAXPDSTRING, 0); + + if (fd < 0) { + /* if canvas_open() failed try open_via_helppath() */ + pd_error(x, "didn't find %s, trying open_via_helppath()", objectname); + open_via_helppath(objectname, canvas_getdir(x->x_glist)->s_name); + } else { + /* if canvas_open() gave us a filehandle, then we have a helppatch to + * open in dirbuf and nameptr, but we don't need the filehandle */ + close(fd); + pd_error(x, "found objectname %s", objectname); + error("dirbuf %s", dirbuf); + error("nameptr %s", nameptr); + glob_evalfile(x, gensym(nameptr), gensym(dirbuf)); + } } static int helplink_wbclick(t_gobj *z, t_glist *glist, int xpix, int ypix, -- cgit v1.2.1