aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2010-06-17 19:50:23 +0000
committerHans-Christoph Steiner <eighthave@users.sourceforge.net>2010-06-17 19:50:23 +0000
commit500dfb45f31824ad159f04372cd27ed4948389bd (patch)
tree79d0edc76711b4c15d5f2ffb8d55853fcb92a84c
parent72877db46a48421bf4bea6702eb329b7288b5e35 (diff)
made handling of new pattern work better
svn path=/trunk/externals/ezfile/; revision=13671
-rw-r--r--getfilenames.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/getfilenames.c b/getfilenames.c
index 86d090d..580069c 100644
--- a/getfilenames.c
+++ b/getfilenames.c
@@ -37,8 +37,8 @@
#include <stdio.h>
#include <string.h>
-//#define DEBUG(x)
-#define DEBUG(x) x
+#define DEBUG(x)
+//#define DEBUG(x) x
/*------------------------------------------------------------------------------
* CLASS DEF
@@ -49,6 +49,7 @@ typedef struct _getfilenames {
t_object x_obj;
t_symbol* x_pattern;
t_canvas* x_canvas;
+ int isnewpattern;
#ifdef _WIN32
HANDLE hFind;
#else
@@ -159,7 +160,7 @@ static void getfilenames_rewind(t_getfilenames* x)
}
} while (FindNextFile(hFind, &findData) != 0);
FindClose(hFind);
-#else
+#else /* systems with glob */
DEBUG(post("globbing %s",normalized_path););
x->current_glob_position = 0;
switch( glob( normalized_path, GLOB_TILDE, NULL, &x->glob_buffer ) )
@@ -178,7 +179,7 @@ static void getfilenames_rewind(t_getfilenames* x)
break;
# endif
}
-#endif
+#endif /* _WIN32 */
}
@@ -210,12 +211,17 @@ static void getfilenames_set(t_getfilenames* x, t_symbol *s)
static void getfilenames_symbol(t_getfilenames *x, t_symbol *s)
{
- getfilenames_set(x,s);
- getfilenames_rewind(x);
+ getfilenames_set(x,s);
+ x->isnewpattern = 1;
}
static void getfilenames_bang(t_getfilenames *x)
{
+ if(x->isnewpattern)
+ {
+ getfilenames_rewind(x);
+ x->isnewpattern = 0;
+ }
if(x->current_glob_position < x->glob_buffer.gl_pathc)
{
outlet_symbol( x->data_outlet,
@@ -249,11 +255,11 @@ static void *getfilenames_new(t_symbol *s)
{
currentdir = canvas_getcurrentdir();
strncpy(buffer,currentdir->s_name,MAXPDSTRING);
- /* TODO this should default to the patch's dir */
strncat(buffer,"/*",MAXPDSTRING);
x->x_pattern = gensym(buffer);
- post("setting pattern to default: %s",x->x_pattern->s_name);
+ post("setting pattern to default: *");
}
+ x->isnewpattern = 1;
return (x);
}