aboutsummaryrefslogtreecommitdiff
path: root/folder_list.c
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2006-06-12 14:17:12 +0000
committerHans-Christoph Steiner <eighthave@users.sourceforge.net>2006-06-12 14:17:12 +0000
commit63cdcee4fbf0bf90c4f91d9cc20e4f9acb5d2d41 (patch)
treee7528f3cd712a15e4f107bcad65c95d5341110bc /folder_list.c
parent17d535783bef12879d021358d616e22bab911cfb (diff)
changed default folder to folder of current patch
svn path=/trunk/externals/hcs/; revision=5190
Diffstat (limited to 'folder_list.c')
-rw-r--r--folder_list.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/folder_list.c b/folder_list.c
index 0c0dede..fcbbcfa 100644
--- a/folder_list.c
+++ b/folder_list.c
@@ -34,7 +34,9 @@
#include <glob.h>
#endif
-static char *version = "$Revision: 1.9 $";
+#include <string.h>
+
+static char *version = "$Revision: 1.10 $";
t_int folder_list_instance_count;
@@ -47,8 +49,8 @@ t_int folder_list_instance_count;
static t_class *folder_list_class;
typedef struct _folder_list {
- t_object x_obj;
- t_symbol *x_pattern;
+ t_object x_obj;
+ t_symbol *x_pattern;
} t_folder_list;
/*------------------------------------------------------------------------------
@@ -164,28 +166,35 @@ static void *folder_list_new(t_symbol *s)
DEBUG(post("folder_list_new"););
t_folder_list *x = (t_folder_list *)pd_new(folder_list_class);
-
+ t_symbol *currentdir;
+ char buffer[MAXPDSTRING];
+
if(!folder_list_instance_count)
{
post("[folder_list] %s",version);
post("\twritten by Hans-Christoph Steiner <hans@at.or.at>");
+ post("\tcompiled on "__DATE__" at "__TIME__ " ");
}
folder_list_instance_count++;
- /* TODO set current dir of patch as default */
-#ifdef _WIN32
- x->x_pattern = gensym(getenv("USERPROFILE"));
-#else
- x->x_pattern = gensym(getenv("HOME"));
-#endif
symbolinlet_new(&x->x_obj, &x->x_pattern);
outlet_new(&x->x_obj, &s_symbol);
/* set to the value from the object argument, if that exists */
if (s != &s_)
+ {
x->x_pattern = s;
-
+ }
+ else
+ {
+ currentdir = canvas_getcurrentdir();
+ strncpy(buffer,currentdir->s_name,MAXPDSTRING);
+ strncat(buffer,"/*",MAXPDSTRING);
+ x->x_pattern = gensym(buffer);
+ post("setting pattern to default: %s",x->x_pattern->s_name);
+ }
+
return (x);
}