Update of /cvsroot/pure-data/externals/loaders In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11407
Modified Files: libdir.c Log Message: fixed loading of externals for pd0.40
Index: libdir.c =================================================================== RCS file: /cvsroot/pure-data/externals/loaders/libdir.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** libdir.c 23 Nov 2006 15:57:28 -0000 1.5 --- libdir.c 29 Jan 2007 19:18:23 -0000 1.6 *************** *** 39,45 **** static int libdir_loader(t_canvas *canvas, char *classname) { ! int fd = -1; ! char fullclassname[MAXPDSTRING], dirbuf[MAXPDSTRING], *nameptr; ! t_canvasenvironment *canvasenvironment;
/* look for meta file (classname)/(classname)-meta.pd */ --- 39,46 ---- static int libdir_loader(t_canvas *canvas, char *classname) { ! int fd = -1, i; ! char fullclassname[MAXPDSTRING], dirbuf[MAXPDSTRING]; ! char reldirbuf[MAXPDSTRING], curdir[MAXPDSTRING], *nameptr; ! t_canvasenvironment *canvasenvironment;
/* look for meta file (classname)/(classname)-meta.pd */ *************** *** 61,67 **** } close(fd); // TODO: have this add to the canvas-local path only canvasenvironment->ce_path = namelist_append(canvasenvironment->ce_path, ! dirbuf, 0); post("libdir_loader: added %s to the canvas-local path", classname); } --- 62,85 ---- } close(fd); + + + // G.Holzmann: canvas will look to a relative path to it, so we cannot add + // the absulote dirbuf path, we have to make it relative to the current canvas + // (see from line 1561 in g_canvas.c) + + sys_unbashfilename(canvas_getdir(canvas)->s_name, curdir); + + // count depth of the current dir + for(i=0; i<strlen(curdir); i++) + { + if(curdir[i] == 47) // 47 is "/" in ascii + strncat(reldirbuf, "../", MAXPDSTRING); + } + strncat(reldirbuf, dirbuf, MAXPDSTRING); + + // TODO: have this add to the canvas-local path only canvasenvironment->ce_path = namelist_append(canvasenvironment->ce_path, ! reldirbuf, 0); post("libdir_loader: added %s to the canvas-local path", classname); }