diff options
author | Hans-Christoph Steiner <eighthave@users.sourceforge.net> | 2009-04-16 19:26:57 +0000 |
---|---|---|
committer | Hans-Christoph Steiner <eighthave@users.sourceforge.net> | 2009-04-16 19:26:57 +0000 |
commit | 7e5b1497b18a9f504df3366705d34ae727f47c16 (patch) | |
tree | 1d1cb10d06d22be5eefd18d1c338b697a878f0d5 /externals | |
parent | 282e416ef5570bf3bcd25e61c2fc0f3b60425785 (diff) |
- added verbosity control at Phil Stone's suggestion
- cleaned up code an removed support for Pd < 0.40
svn path=/trunk/; revision=11040
Diffstat (limited to 'externals')
-rw-r--r-- | externals/loaders/libdir.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/externals/loaders/libdir.c b/externals/loaders/libdir.c index 4ca710f9..c48f9b7a 100644 --- a/externals/loaders/libdir.c +++ b/externals/loaders/libdir.c @@ -5,6 +5,8 @@ #include <string.h> #include <unistd.h> +/* this object requires Pd 0.40.3 or later */ + /* WARNING: KLUDGE! */ /* * this struct is not publically defined (its in g_canvas.c) so I need to @@ -39,9 +41,8 @@ static char *version = "$Revision: 1.8 $"; static int libdir_loader(t_canvas *canvas, char *classname) { int fd = -1; - unsigned int i; char helppathname[FILENAME_MAX]; - char fullclassname[FILENAME_MAX], dirbuf[FILENAME_MAX], pathbuf[FILENAME_MAX]; + char fullclassname[FILENAME_MAX], dirbuf[FILENAME_MAX]; char *nameptr; t_canvasenvironment *canvasenvironment; @@ -53,7 +54,6 @@ static int libdir_loader(t_canvas *canvas, char *classname) /* if this is being called from a canvas, then add the library path to the * canvas-local path */ -#if (PD_MINOR_VERSION >= 40) if(canvas) { canvasenvironment = canvas_getenv(canvas); @@ -64,12 +64,14 @@ static int libdir_loader(t_canvas *canvas, char *classname) return (0); } close(fd); + if(! sys_isabsolutepath(dirbuf)) canvasenvironment->ce_path = namelist_append(canvasenvironment->ce_path, dirbuf, 0); - post("libdir_loader: added '%s' to the canvas-local objectclass path", classname); + if(sys_verbose) + post("libdir_loader: added '%s' to the canvas-local objectclass path", + classname); } else -#endif { if ((fd = open_via_path(".", fullclassname, ".pd", dirbuf, &nameptr, FILENAME_MAX, 0)) < 0) @@ -83,7 +85,8 @@ static int libdir_loader(t_canvas *canvas, char *classname) strcat(helppathname, "/doc/5.reference/"); strcat(helppathname, classname); sys_helppath = namelist_append(sys_helppath, helppathname, 0); - post("libdir_loader: added '%s' to the global objectclass path", classname); + post("libdir_loader: added '%s' to the global objectclass path", + classname); // post("\tThis is deprecated behavior."); } /* post("libdir_loader loaded fullclassname: '%s'\n", fullclassname); */ @@ -96,12 +99,7 @@ static int libdir_loader(t_canvas *canvas, char *classname) void libdir_setup(void) { /* relies on t.grill's loader functionality, fully added in 0.40 */ -#if (PD_MINOR_VERSION >= 40) sys_register_loader(libdir_loader); -#else - error("ERROR: to function, libdir needs to be compiled against Pd 0.40 or higher,\n"); - post("\tor a version that has sys_register_loader()"); -#endif post("libdir loader %s",version); post("\tcompiled on "__DATE__" at "__TIME__ " "); post("\tcompiled against Pd version %d.%d.%d.%s", PD_MAJOR_VERSION, |