-- Added folders in fonts
This commit is contained in:
parent
13eb54a29d
commit
8ba0c751cb
5 changed files with 100 additions and 100 deletions
|
@ -131,7 +131,35 @@ static void fileselector_output(t_fileselector* x)
|
|||
if((x->x_type > 74) && (x->x_type<100)) // Make the fonts path
|
||||
{
|
||||
strncat(path,"/fonts/*",8);
|
||||
}
|
||||
switch(glob(path, GLOB_TILDE, NULL, &glob_buffer))
|
||||
{
|
||||
case GLOB_NOSPACE:
|
||||
pd_error(x,"[fileselector] out of memory for \"%s\"",path);
|
||||
break;
|
||||
# ifdef GLOB_ABORTED
|
||||
case GLOB_ABORTED:
|
||||
pd_error(x,"[fileselector] aborted \"%s\"",path);
|
||||
break;
|
||||
# endif
|
||||
# ifdef GLOB_NOMATCH
|
||||
case GLOB_NOMATCH:
|
||||
pd_error(x,"[fileselector] nothing found for %s ",path);
|
||||
break;
|
||||
# endif
|
||||
}
|
||||
i = x->x_folder;
|
||||
if (i < glob_buffer.gl_pathc)
|
||||
{
|
||||
strncpy(path, glob_buffer.gl_pathv[i],strnlen(glob_buffer.gl_pathv[i],FILENAME_MAX));
|
||||
strncat(path, "/*", 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
post("fileselector: folder is greater than the number of folders");
|
||||
globfree(&glob_buffer);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(x->x_type == 256) // Make the path sound
|
||||
{
|
||||
strncat(path,"/sound/*",8);
|
||||
|
@ -233,7 +261,6 @@ void fileselector_setup(void)
|
|||
fileselector_class = class_new(gensym("fileselector"),(t_newmethod)fileselector_new,0,sizeof(t_fileselector),0,A_DEFSYMBOL,A_DEFFLOAT,A_DEFFLOAT,A_DEFFLOAT, 0);
|
||||
/* add inlet datatype methods */
|
||||
class_addbang(fileselector_class,(t_method) fileselector_output);
|
||||
// class_addsymbol(fileselector_class,(t_method) fileselector_symbol);
|
||||
/* add inlet message methods */
|
||||
class_addmethod(fileselector_class,(t_method)fileselector_set,gensym("set"),A_DEFSYMBOL, 0);
|
||||
// add inlet folder
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue