Update of /cvsroot/pure-data/externals/zexy/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20418
Modified Files: msgfile.c Log Message: hopefully fixed a bug with not finding relative filenames (when "." was not in the path)
Index: msgfile.c =================================================================== RCS file: /cvsroot/pure-data/externals/zexy/src/msgfile.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** msgfile.c 19 May 2005 09:42:55 -0000 1.2 --- msgfile.c 8 Jun 2005 17:07:21 -0000 1.3 *************** *** 516,521 **** int fd; long readlength, length; ! char filnam[MAXPDSTRING]; char buf[MAXPDSTRING], *bufptr, *readbuf;
int mode = x->mode; --- 516,522 ---- int fd; long readlength, length; ! char filnam[MAXPDSTRING], namebuf[MAXPDSTRING]; char buf[MAXPDSTRING], *bufptr, *readbuf; + char*dirname=canvas_getdir(x->x_canvas)->s_name;
int mode = x->mode; *************** *** 524,540 **** t_binbuf *bbuf = binbuf_new();
! if ((fd = open_via_path(canvas_getdir(x->x_canvas)->s_name, filename->s_name, "", buf, &bufptr, MAXPDSTRING, 0)) < 0) { ! error("%s: can't open", filename->s_name); ! return; ! } ! else close (fd);
! if (!strcmp(format->s_name, "cr")) { mode = CR_MODE; ! } else if (!strcmp(format->s_name, "csv")) { mode = CSV_MODE; ! } else if (!strcmp(format->s_name, "pd")) { mode = PD_MODE; } else if (*format->s_name) --- 525,562 ---- t_binbuf *bbuf = binbuf_new();
! ! #ifdef NT ! rmode |= O_BINARY; ! #endif ! ! if ((fd = open_via_path(dirname, filename->s_name, "", buf, &bufptr, MAXPDSTRING, 0)) < 0) { ! ! if(fd=open(filename->s_name, rmode) < 0) { ! error("%s: can't open in %s", filename->s_name, dirname); ! return; ! } ! } else { close (fd);
! namebuf[0] = 0; ! if (*buf) ! strcat(namebuf, buf), strcat(namebuf, "/"); ! strcat(namebuf, bufptr); ! ! /* open and get length */ ! sys_bashfilename(namebuf, filnam); ! ! if ((fd = open(filnam, rmode)) < 0) { ! error("msgfile_read: unable to open %s", filnam); ! return; ! } ! } ! ! if (gensym("cr")==format) { mode = CR_MODE; ! } else if (gensym("csv")==format) { mode = CSV_MODE; ! } else if (gensym("pd")==format) { mode = PD_MODE; } else if (*format->s_name) *************** *** 556,570 **** }
- /* open and get length */ - sys_bashfilename(filename->s_name, filnam); - - #ifdef NT - rmode |= O_BINARY; - #endif - - if ((fd = open(filnam, rmode)) < 0) { - error("msgfile_read: unable to open %s", filnam); - return; - } if ((length = lseek(fd, 0, SEEK_END)) < 0 || lseek(fd, 0,SEEK_SET) < 0 || !(readbuf = t_getbytes(length))) { --- 578,581 ----