[PD] nn_tile - search file

Christof Ressi info at christofressi.com
Wed Aug 24 22:26:26 CEST 2022


Hi Denis,

open_via_path() only considers the global search paths. You (almost) 
always want to use canvas_open() instead, which also uses the canvas 
environment (i.e. patch relative paths + paths added with [declare]).

Note that you would need a reference to the containing canvas. This can 
be done by calling canvas_getcurrent() in the constructor and storing 
the resulting t_canvas* in the object.

Christof

On 24.08.2022 21:55, Denis Połeć wrote:
> Hello,
>
> I am currently experimenting with the external nn_tilde. (https://github.com/acids-ircam/nn_tilde) I compiled it for my machine (Apple Silicion) and it works so far. It is fun.
>
> There is a little thing which is annoying. I just can load the pretrained models with the absolute path. Everything else fails. (declare paths etc....) This is not really handy.
> Does someone face the same problem?
>
> This should be the function which handle the file search. (https://github.com/acids-ircam/nn_tilde/blob/master/src/frontend/puredata/nn_tilde/nn_tilde.cpp) I can't see any issue.
> ... Let's say I am not able to see any issue. ;)
>
>   // SEARCH FOR FILE
>    if (!sys_isabsolutepath(x->m_path->s_name)) {
>      char dirname[MAXPDSTRING], *dummy;
>      auto fd = open_via_path("", x->m_path->s_name, "", dirname, &dummy,
>                              MAXPDSTRING, 1);
>      std::string found_path;
>      found_path += dirname;
>      found_path += "/";
>      found_path += x->m_path->s_name;
>      x->m_path = gensym(found_path.c_str());
>    }
>
> cheers
> denis
>
>
> _______________________________________________
> Pd-list at lists.iem.at mailing list
> UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list





More information about the Pd-list mailing list