From f802a8da9d8d7e53f3407ae6771a7a4352b832fa Mon Sep 17 00:00:00 2001 From: "N.N." Date: Tue, 27 Jan 2015 18:53:04 +0000 Subject: For cyclone/funbuff, filter out the non-object name part during file write, so it doesn't break while reading it back. Reported as bug #1188 svn path=/trunk/externals/miXed/; revision=17419 --- cyclone/hammer/funbuff.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/cyclone/hammer/funbuff.c b/cyclone/hammer/funbuff.c index 8328ffd..b5a8dbd 100644 --- a/cyclone/hammer/funbuff.c +++ b/cyclone/hammer/funbuff.c @@ -2,6 +2,7 @@ * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ +#include #include "m_pd.h" #include "common/loud.h" #include "common/vefl.h" @@ -227,10 +228,16 @@ static void funbuff_dowrite(t_funbuff *x, t_symbol *fn) t_binbuf *bb = binbuf_new(); char buf[MAXPDSTRING]; t_hammernode *np; - binbuf_addv(bb, "s", atom_getsymbol(binbuf_getvec(x->x_ob.te_binbuf))); + /* specifying the object as cyclone/funbuff breaks the file writing/ + * reading as the it doesn't start with 'funbuff'. A call to + * libgen/basename fixes this. fjk, 2015-01-24 */ + t_symbol *objName = atom_getsymbol(binbuf_getvec(x->x_ob.te_binbuf)); + objName->s_name = basename(objName->s_name); + binbuf_addv(bb, "s", objName); for (np = x->x_tree.t_first; np; np = np->n_next) binbuf_addv(bb, "if", np->n_key, HAMMERNODE_GETFLOAT(np)); canvas_makefilename(x->x_canvas, fn->s_name, buf, MAXPDSTRING); + binbuf_write(bb, buf, "", 0); binbuf_free(bb); } @@ -270,7 +277,7 @@ static void funbuff_read(t_funbuff *x, t_symbol *s) a bug? but CHECKME other classes (cf seq's filetype dilemma) */ static void funbuff_write(t_funbuff *x, t_symbol *s) { - if (s && s != &s_) + if (s && s != &s_) funbuff_dowrite(x, s); else /* CHECKME default name */ hammerpanel_save(x->x_filehandle, @@ -523,4 +530,6 @@ void funbuff_setup(void) gensym("debug"), A_DEFFLOAT, 0); #endif hammerfile_setup(funbuff_class, 1); + logpost(NULL, 4, "this is cyclone/funbuff %s, %dth %s build", + CYCLONE_VERSION, CYCLONE_BUILD, CYCLONE_RELEASE); } -- cgit v1.2.1